示例#1
0
 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')
示例#2
0
 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')
示例#3
0
 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)
示例#4
0
 def test_get_json_bad_response(self):
     with patch('requests.get', return_value=mock_response(400)):
         with self.assertRaises(HTTPError):
             self.job.get_json()
示例#5
0
 def test_stop_build_ok(self):
     with patch('requests.post', return_value=mock_response(200, '')):
         response = self.job.stop_build('20')
         self.assertTrue(response)
示例#6
0
 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')
示例#7
0
 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)
示例#8
0
 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)
示例#9
0
 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')
示例#10
0
 def test_stop_build_ok(self):
     with patch('requests.post', return_value=mock_response(200, '')):
         response = self.job.stop_build('20')
         self.assertTrue(response)
示例#11
0
 def test_get_json_bad_response(self):
     with patch('requests.get', return_value=mock_response(400)):
         with self.assertRaises(HTTPError):
             self.job.get_json()
示例#12
0
 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)