def test_twitter_auth_url(mock_session, mock_requests): response_content = b'oauth_token=peaches&oauth_token_secret=pears' mock_requests.post().content = response_content mock_requests.post().status_code = 200 resp = VerificationService.twitter_auth_url() resp_data = resp.data assert isinstance(resp, VerificationServiceResponse) assert resp_data['url'] == ('https://api.twitter.com/oauth/authenticate?' 'oauth_token=peaches')
def test_twitter_auth_url(app): response_content = b'oauth_token=peaches&oauth_token_secret=pears' responses.add(responses.POST, twitter_request_token_url, body=response_content, status=200) with app.test_request_context(): verification_response = VerificationService.twitter_auth_url() assert isinstance(verification_response, VerificationServiceResponse) assert verification_response.data['url'] == ( 'https://api.twitter.com/oauth/authenticate?oauth_token=peaches')