Here are the examples of the python api mock.sentinel.url taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
8 Examples
3
Example 1
Project: pyon Source File: test_exchange.py
@patch('pyon.ion.exchange.json')
@patch('pyon.ion.exchange.requests')
def test__call_management(self, reqmock, jsonmock):
content = self.ex_manager._call_management(sentinel.url)
self.assertEquals(content, jsonmock.loads.return_value)
reqmock.get.assert_called_once_with(sentinel.url, auth=('user', 'pass'), data=None)
3
Example 2
Project: pyon Source File: test_exchange.py
@patch('pyon.ion.exchange.json')
@patch('pyon.ion.exchange.requests')
def test__call_management_delete(self, reqmock, jsonmock):
content = self.ex_manager._call_management_delete(sentinel.url)
self.assertEquals(content, jsonmock.loads.return_value)
reqmock.delete.assert_called_once_with(sentinel.url, auth=('user', 'pass'), data=None)
3
Example 3
Project: pyon Source File: test_exchange.py
@patch('pyon.ion.exchange.json')
@patch('pyon.ion.exchange.requests')
def test__make_management_call(self, reqmock, jsonmock):
content = self.ex_manager._make_management_call(sentinel.url, method="scoop")
reqmock.scoop.assert_called_once_with(sentinel.url, auth=('user', 'pass'), data=None)
3
Example 4
Project: pyon Source File: test_exchange.py
def test__make_management_call_delegates_to_ems(self):
self.ex_manager._ems_available = Mock(return_value=True)
content = self.ex_manager._make_management_call(sentinel.url, method=sentinel.anymeth)
self.ex_manager._ems_client.call_management.assert_called_once_with(sentinel.url, sentinel.anymeth, headers=None)
3
Example 5
Project: pyon Source File: test_exchange.py
def test__make_management_call_raises_exceptions(self):
rmock = Mock()
rmock.return_value.raise_for_status.side_effect = requests.exceptions.Timeout
with patch('pyon.ion.exchange.requests.get', rmock):
self.assertRaises(exception.Timeout, self.ex_manager._make_management_call, sentinel.url, use_ems=False)
3
Example 6
Project: cloudbase-init Source File: test_base.py
def _test_verify_https_request(self, https_ca_bundle=None):
mock_service = base.BaseHTTPMetadataService(
base_url=mock.sentinel.url,
https_allow_insecure=mock.sentinel.allow_insecure,
https_ca_bundle=https_ca_bundle)
response = mock_service._verify_https_request()
if not https_ca_bundle:
self.assertTrue(mock.sentinel.allow_insecure)
else:
self.assertEqual(response, https_ca_bundle)
3
Example 7
Project: oslo.vmware Source File: test_service.py
def test_send_with_connection_timeout(self):
transport = service.RequestsTransport(connection_timeout=120)
request = mock.Mock(url=mock.sentinel.url,
message=mock.sentinel.message,
headers=mock.sentinel.req_headers)
with mock.patch.object(transport.session, "post") as mock_post:
transport.send(request)
mock_post.assert_called_once_with(
mock.sentinel.url,
data=mock.sentinel.message,
headers=mock.sentinel.req_headers,
timeout=120,
verify=transport.verify)
3
Example 8
def test_raises_not_implemented(self, base_requester):
url = mock.sentinel.url
data = mock.sentinel.data
headers = mock.sentinel.headers
files = mock.sentinel.files
with pytest.raises(NotImplementedError):
base_requester.make_request(
url, data=data, headers=headers, files=files)