def testApplicationCache(self): a = Application() a.name = "Test App" a.client_secret = "abc" a.id = "test-id" a.created_by = "Nick" a.save() application_cache().load_from_db() self.assertIn(a, application_cache().all())
def setUp(self): self.client = Client() self.user_finder = MockUserFinder() self.user = self.user_finder.find(id=12) a = Application() a.id = uuid.uuid4().hex a.name = "Test Application" a.created_by = self.user['id'] a.client_secret = uuid.uuid4().hex a.redirect_uri = "http://example.com/redirect" a.save() self.application = a
def testInvalidateCacheView(self): a = Application() a.id = uuid.uuid4().hex a.client_secret = uuid.uuid4().hex a.super_application = True a.name = "Test Super App" a.redirect_uri = "/" a.created_by = "nick" a.save() sig = application_hasher(a, "secret") post_data = { 'uncache_type': 'user_request', 'user_id': 123 } resp = self.client.post("/cache/invalidate?client_id=%s&signature=%s&verify=%s" % (a.id, sig, "secret"), data=post_data) self.assertEqual('{"message": "OK"}', resp.content.decode())