"""Test the functionality used by the test runner."""
import omni.kit.app
import omni.kit.test


class TestLookups(omni.kit.test.AsyncTestCase):
    async def test_lookups(self):
        """Oddly self-referencing test that uses the test runner test lookup utility to confirm that the utility
        finds this test.
        """
        manager = omni.kit.app.get_app().get_extension_manager()
        my_extension_id = manager.get_enabled_extension_id("omni.kit.test")

        module_map = omni.kit.test.get_module_to_extension_map()
        self.assertTrue("omni.kit.test" in module_map)
        extension_info = module_map["omni.kit.test"]
        self.assertEqual((my_extension_id, True), extension_info)

        this_test_info = omni.kit.test.extension_from_test_name("omni.kit.test.TestLookups.test_lookups", module_map)
        self.assertIsNotNone(this_test_info)
        this_test_info_no_module = tuple(e for i, e in enumerate(this_test_info) if i != 2)
        self.assertEqual((my_extension_id, True, False), this_test_info_no_module)
