from test.test_api_usage import ApiTestCase from endpoints.api.suconfig import SuperUserRegistryStatus from app import config_provider import unittest class FreshConfigProvider(object): def __enter__(self): config_provider.reset_for_test() return config_provider def __exit__(self, type, value, traceback): config_provider.reset_for_test() class TestSuperUserRegistryStatus(ApiTestCase): def test_registry_status(self): with FreshConfigProvider(): json = self.getJsonResponse(SuperUserRegistryStatus) self.assertEquals('config-db', json['status']) if __name__ == '__main__': unittest.main()