3
0
Fork 0

fix: always use 'wutta' prefix for provider entry points

otherwise not all providers will be discoverable, for custom appname

also add `appname` prop for GenericHandler, AppProvider
This commit is contained in:
Lance Edgar 2024-07-14 10:45:13 -05:00
parent f6d0912c03
commit b4d6cfb0ed
2 changed files with 37 additions and 9 deletions

View file

@ -134,6 +134,7 @@ class TestAppProvider(TestCase):
provider = app.AppProvider(self.config)
self.assertIs(provider.config, self.config)
self.assertIs(provider.app, self.app)
self.assertEqual(provider.appname, 'wuttatest')
# but can pass app handler instead
with warnings.catch_warnings():
@ -155,7 +156,7 @@ class TestAppProvider(TestCase):
# sanity check, we get *instances* back from this
providers = self.app.get_all_providers()
load_entry_points.assert_called_once_with('wuttatest.providers')
load_entry_points.assert_called_once_with('wutta.app.providers')
self.assertEqual(len(providers), 1)
self.assertIn('fake', providers)
self.assertIsInstance(providers['fake'], FakeProvider)
@ -212,3 +213,4 @@ class TestGenericHandler(TestCase):
handler = app.GenericHandler(self.config)
self.assertIs(handler.config, self.config)
self.assertIs(handler.app, self.app)
self.assertEqual(handler.appname, 'wuttatest')