# Copyright (c) 2022, InfluxFramework LLC
# License: MIT. See LICENSE
import influxframework
from influxframework.config import get_modules_from_all_apps_for_user
from influxframework.tests.utils import InfluxFrameworkTestCase


class TestConfig(InfluxFrameworkTestCase):
	def test_get_modules(self):
		influxframework_modules = influxframework.get_all("Module Def", filters={"app_name": "influxframework"}, pluck="name")
		all_modules_data = get_modules_from_all_apps_for_user()
		first_module_entry = all_modules_data[0]
		all_modules = [x["module_name"] for x in all_modules_data]
		self.assertIn("links", first_module_entry)
		self.assertIsInstance(all_modules_data, list)
		self.assertFalse([x for x in influxframework_modules if x not in all_modules])
