예제 #1
0
 def test_create(self):
     self.assertEqual(len(db_oauth_token.list_tokens()), 0)
     db_oauth_token.create(
         client_id=self.oauth_client["client_id"],
         access_token="Test Access Token",
         refresh_token="Test Refresh Token",
         expires=datetime.now() + timedelta(seconds=200),
         user_id=self.user.id,
         scopes=None,
     )
     self.assertEqual(len(db_oauth_token.list_tokens()), 1)
예제 #2
0
 def test_list(self):
     db_oauth_token.create(
         client_id=self.oauth_client["client_id"],
         access_token="Test Access Token",
         refresh_token="Test Refresh Token",
         expires=datetime.now() + timedelta(seconds=200),
         user_id=self.user.id,
         scopes=None,
     )
     self.assertEqual(len(db_oauth_token.list_tokens(client_id=self.oauth_client["client_id"])), 1)
     self.assertEqual(len(db_oauth_token.list_tokens(refresh_token="Test Refresh Token")), 1)
예제 #3
0
 def fetch_access_token(access_token):
     tokens = db_oauth_token.list_tokens(access_token=access_token)
     return tokens[0] if tokens else None
예제 #4
0
 def fetch_token(client_id, refresh_token):
     tokens = db_oauth_token.list_tokens(client_id=client_id, refresh_token=refresh_token)
     return tokens[0] if tokens else None
예제 #5
0
 def fetch_access_token(access_token):
     token = db_oauth_token.list_tokens(access_token=access_token)[0]
     return token
예제 #6
0
 def fetch_token(client_id, refresh_token):
     token = db_oauth_token.list_tokens(client_id=client_id, refresh_token=refresh_token)[0]
     return token