def test_update_desc_bad_response(self): with patch('requests.post', return_value=mock_response(400, '')): with self.assertRaises(HTTPError): self.job.update_build_desc('20', 'new description')
def test_stop_build_bad_response(self): with patch('requests.post', return_value=mock_response(400, '')): with self.assertRaises(HTTPError): self.job.stop_build('20')
def test_update_desc_ok(self): with patch('requests.post', return_value=mock_response(200, '')): response = self.job.update_build_desc('20', 'new description') self.assertTrue(response)
def test_get_json_bad_response(self): with patch('requests.get', return_value=mock_response(400)): with self.assertRaises(HTTPError): self.job.get_json()
def test_stop_build_ok(self): with patch('requests.post', return_value=mock_response(200, '')): response = self.job.stop_build('20') self.assertTrue(response)
def test_update_desc_bad_response(self): with patch('requests.post', return_value=mock_response(400, '')): with self.assertRaises(HTTPError): self.job.update_build_desc( '20', 'new description')
def test_get_json_ok(self): data = sample_data([Pr('1').dict], []) with patch('requests.get', return_value=mock_response(200, data)): response = self.job.get_json() self.assertEqual(data, response)