Here are the examples of the python api mock.sentinel.ok taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
5 Examples
3
Example 1
def setUp(self):
self.parse_mock = patch(
'saleor.registration.utils.parse_response').start()
self.requests_mock = patch(
'saleor.registration.utils.requests').start()
self.requests_mock.codes.ok = sentinel.ok
3
Example 2
Project: saleor Source File: test_registration.py
def test_token_is_obtained_on_construction(self):
"""OAuth2 client asks for access token if interim code is available"""
self.access_token_response.status_code = sentinel.ok
Client(local_host='http://localhost', code=sentinel.code)
self.requests_mock.post.assert_called_once_with(
sentinel.token_uri,
data={'grant_type': 'authorization_code',
'client_id': sentinel.client_id,
'client_secret': sentinel.client_secret,
'code': sentinel.code,
'redirect_uri': sentinel.redirect_uri,
'scope': sentinel.scope},
auth=None)
3
Example 3
Project: saleor Source File: test_registration.py
def test_token_success(self):
"""OAuth2 client properly obtains access token"""
client = Client(local_host='http://localhost')
self.access_token_response.status_code = sentinel.ok
access_token = client.get_access_token(code=sentinel.code)
assert access_token == sentinel.access_token
self.requests_mock.post.assert_called_once_with(
sentinel.token_uri,
data={'grant_type': 'authorization_code',
'client_id': sentinel.client_id,
'client_secret': sentinel.client_secret,
'code': sentinel.code,
'redirect_uri': sentinel.redirect_uri,
'scope': sentinel.scope},
auth=None)
3
Example 4
Project: saleor Source File: test_registration.py
@override_settings(FACEBOOK_APP_ID='112233', FACEBOOK_SECRET='abcd')
def test_facebook_user_data_account_not_verified(self):
"""Facebook OAuth2 client checks for account verification"""
self.user_info_response.status_code = sentinel.ok
self.parse_mock.return_value = {'verified': False}
self.assertRaises(ValueError, self.facebook_client.get_user_info)
0
Example 5
Project: saleor Source File: test_registration.py
def test_google_user_data_email_not_verified(self):
"""Google OAuth2 client checks for email verification"""
self.user_info_response.status_code = sentinel.ok
self.parse_mock.return_value = {'verified_email': False}
self.assertRaises(ValueError, self.google_client.get_user_info)