Пример #1
0
 def test_exists_bad_server(self):
     """Verify the client can look for a bad server."""
     mock_head = Mock(side_effect=requests.exceptions.RequestException)
     # Act
     with patch('requests.head', mock_head):
         exists = client.exists()
     # Assert
     url = 'http://1.2.3.4:8080/documents'
     mock_head.assert_called_once_with(url)
     self.assertFalse(exists)
Пример #2
0
 def test_exists_bad_server(self):
     """Verify the client can look for a bad server."""
     mock_head = Mock(side_effect=requests.exceptions.RequestException)
     # Act
     with patch('requests.head', mock_head):
         exists = client.exists()
     # Assert
     url = 'http://1.2.3.4:8080/documents'
     mock_head.assert_called_once_with(url)
     self.assertFalse(exists)
Пример #3
0
 def test_exists_bad_path(self):
     """Verify the client can look for a bad server path."""
     mock_response = Mock()
     mock_response.status_code = 404
     mock_head = Mock(return_value=mock_response)
     # Act
     with patch('requests.head', mock_head):
         exists = client.exists()
     # Assert
     url = 'http://1.2.3.4:8080/documents'
     mock_head.assert_called_once_with(url)
     self.assertFalse(exists)
Пример #4
0
 def test_exists_bad_path(self):
     """Verify the client can look for a bad server path."""
     mock_response = Mock()
     mock_response.status_code = 404
     mock_head = Mock(return_value=mock_response)
     # Act
     with patch('requests.head', mock_head):
         exists = client.exists()
     # Assert
     url = 'http://1.2.3.4:8080/documents'
     mock_head.assert_called_once_with(url)
     self.assertFalse(exists)
Пример #5
0
 def test_exists_unknown(self):
     """Verify the client can look for an empty server."""
     # Act
     exists = client.exists()
     # Assert
     self.assertFalse(exists)
Пример #6
0
 def test_exists_unknown(self):
     """Verify the client can look for an empty server."""
     # Act
     exists = client.exists()
     # Assert
     self.assertFalse(exists)