def testSuperAppKeyProviderValidSuperAppId(self): app = Application.objects.filter(super_application=True) self.assertEqual(len(app), 1) app = app[0] self.assertEqual(app.super_application, True) client_id = app.id r = self.factory.get(path="/", data={"client_id": client_id}) provider = SuperAppKeyProvider() self.assertEqual(provider.authorize(r), app)
def testSuperAppKeyProviderInvalidNonSuperAppId(self): app = Application.objects.filter(super_application=False) self.assertEqual(len(app), 1) app = app[0] self.assertEqual(app.super_application, False) client_id = app.id r = self.factory.get(path="/", data={"client_id": client_id}) provider = SuperAppKeyProvider() result = provider.authorize(r) self.assertIsInstance(result, AuthenticationError)