Example #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')
Example #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')
Example #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)
Example #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()
Example #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)
Example #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')
Example #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)
Example #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)
Example #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')
Example #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)
Example #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()
Example #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)