def test_create(self): self.assertEqual(len(db_oauth_grant.list_grants()), 0) db_oauth_grant.create( client_id=self.oauth_client["client_id"], code="Test Code", redirect_uri="https://example.com", expires=datetime.now() + timedelta(seconds=200), user_id=self.user.id, scopes=None, ) self.assertEqual(len(db_oauth_grant.list_grants()), 1)
def fetch_grant(client_id, code): return db_oauth_grant.list_grants(client_id=client_id, code=code)[0]