예제 #1
0
    def test_start_bad_status(self, mock_requests):
        test_url = "http://test.master.adr:1234"
        test_release = "0.0.0"
        mock_requests.return_value.status_code = 500

        result_code = cli.start(test_url, test_release)

        mock_requests.assert_called_once_with("http://test.master.adr:1234"
                                              "/v1/version",
                                              data='0.0.0')
        self.assertEquals(500, result_code)
예제 #2
0
    def test_start(self, mock_requests):
        test_url = "http://test.master.adr:1234"
        test_release = "0.0.0"
        mock_requests.return_value.status_code = requests.codes.ok

        result_code = cli.start(test_url, test_release)
        print ("Test result is " + str(result_code))

        mock_requests.assert_called_once_with("http://test.master.adr:1234"
                                              "/v1/version",
                                              data='0.0.0')
        self.assertEquals(0, result_code)
예제 #3
0
    def test_start_connection_error(self, mock_requests):
        test_url = "http://test.master.adr:1234"
        test_release = "0.0.0"

        self.assertEqual(2, cli.start(test_url, test_release),
                         "Wrong exit value on ConnectionError test.")