Beispiel #1
0
 def test_before_request(self, refresh, apply):
     cred = credentials.UserAccessTokenCredentials()
     cred.before_request(mock.Mock(), "GET", "https://example.com", {})
     refresh.assert_called()
     apply.assert_called()
Beispiel #2
0
 def test_refresh(self, get_auth_access_token):
     get_auth_access_token.return_value = "access_token"
     cred = credentials.UserAccessTokenCredentials()
     cred.refresh(None)
     assert cred.token == "access_token"
Beispiel #3
0
    def test_with_quota_project(self):
        cred = credentials.UserAccessTokenCredentials()
        quota_project_cred = cred.with_quota_project("project-foo")

        assert quota_project_cred._quota_project_id == "project-foo"
        assert quota_project_cred._account == cred._account
Beispiel #4
0
    def test_instance(self):
        cred = credentials.UserAccessTokenCredentials()
        assert cred._account is None

        cred = cred.with_account("account")
        assert cred._account == "account"