Пример #1
0
    def test_refreshing_credentials(self, run, refresh):
        self.base_credential.token_expiry = datetime.datetime(2012, 01, 01)

        self.session.add(self.base_credential)
        self.session.flush()

        storage = DBCredentialStorage()
        self.assertEqual(storage.get(), 'result')
Пример #2
0
    def test_saving_credentials(self):
        oauth_credentials = OAuth2Credentials(
            access_token='aaa',
            refresh_token='bbb',
            client_id='12345',
            client_secret='1111',
            token_uri=None,
            token_expiry=datetime.datetime.now(),
            user_agent=None
        )

        storage = DBCredentialStorage()
        storage.put(oauth_credentials)

        credentials = self.session.query(GoogleCredential).first()
        self.assertEqual(credentials.access_token, 'aaa')
        self.assertEqual(credentials.client_id, '12345')