def test_stop(self, mock_requests): test_url = "http://test.master.adr:1234" mock_requests.return_value.status_code = requests.codes.ok cli.stop(test_url) mock_requests.assert_called_once_with(test_url + "/v1/version")
def test_stop_bad_status(self, mock_requests): test_url = "http://test.master.adr:1234" mock_requests.return_value.status_code = 500 result_code = cli.stop(test_url) mock_requests.assert_called_once_with("http://test.master.adr:1234" "/v1/version") self.assertEquals(500, result_code)
def test_stop_connection_error(self, mock_requests): test_url = "http://test.master.adr:1234" mock_requests.return_value.status_code = 500 self.assertEqual(2, cli.stop(test_url), "Wrong exit value on ConnectionError test.")