def test_fetch_access_data_can_use_a_custom_oauth_url(self): self.stub_get_requests(response_body=self.valid_response_json) authenticator = Authenticator( client_id="foo", client_secret="bar", oauth_base_url="http://example.com/oauth", ) authenticator.fetch_access_data("some-code") self.assert_get_request("http://example.com/oauth/access_token.json")
def test_fetch_access_data_can_use_a_custom_oauth_url(self): self.stub_get_requests(response_body=self.valid_response_json) authenticator = Authenticator( client_id="foo", client_secret="bar", oauth_base_url="http://example.com/oauth", ) authenticator.fetch_access_data("some-code") self.assert_get_request("http://example.com/oauth/access_token.json")
def test_fetch_access_data_returns_parsed_response_json(self): self.stub_get_requests(response_body=self.valid_response_json) authenticator = Authenticator(client_id="foo", client_secret="bar") response_data = authenticator.fetch_access_data("my-code") self.assert_get_request( url="https://www.yammer.com/oauth2/access_token.json", headers={}, params={ "client_id": "foo", "client_secret": "bar", "code": "my-code", }, ) self.assertEqual(self.valid_response_data, response_data)
def test_fetch_access_data_returns_parsed_response_json(self): self.stub_get_requests(response_body=self.valid_response_json) authenticator = Authenticator(client_id="foo", client_secret="bar") response_data = authenticator.fetch_access_data("my-code") self.assert_get_request( url="https://www.yammer.com/oauth2/access_token.json", headers={}, params={ "client_id": "foo", "client_secret": "bar", "code": "my-code", }, ) self.assertEqual(self.valid_response_data, response_data)