Exemplo n.º 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')
Exemplo n.º 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')
Exemplo n.º 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)
Exemplo n.º 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()
Exemplo n.º 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)
Exemplo n.º 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')
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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')
Exemplo n.º 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)
Exemplo n.º 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()
Exemplo n.º 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)