def test_headers(self): api = WePay(production=False) api._post = MagicMock() api._post.configure_mock(**{'__call__': {'result': 'fake_success'}}) access_token, api_version = 'dummy_access_token', '2011-01-15' expected_headers = { 'Content-Type': 'application/json', 'User-Agent': 'Python WePay SDK (third party)', 'Authorization': 'Bearer %s' % access_token, 'Api-Version': api_version } api.call('/user', access_token=access_token, api_version=api_version) api._post.assert_called_once_with( 'https://stage.wepayapi.com/v2/user', {}, expected_headers, 30)