Beispiel #1
0
 def test_get_open_reviews_502_retry(self):
     """Tests that we retry if we get a 502 response from the server."""
     with mock.patch('requests.get') as mock_get:
         mock_get.side_effect = (FakeResponse("bad proxy gateway",
                                              status_code=502),
                                 FakeResponse("[]\n"))
         self.assertEqual(graph.get_open_reviews('1353131'), [])
     # We call twice because we retried once.
     self.assertEqual(2, mock_get.call_count)
 def test_get_open_reviews_502_retry(self):
     """Tests that we retry if we get a 502 response from the server."""
     with mock.patch('requests.get') as mock_get:
         mock_get.side_effect = (
             FakeResponse("bad proxy gateway", status_code=502),
             FakeResponse("[]\n"))
         self.assertEqual(graph.get_open_reviews('1353131'), [])
     # We call twice because we retried once.
     self.assertEqual(2, mock_get.call_count)
Beispiel #3
0
 def test_get_open_reviews(self):
     with mock.patch('requests.get') as mock_get:
         with open('elastic_recheck/tests/unit/samples/'
                   'gerrit-bug-query.json') as f:
             mock_get.return_value = FakeResponse(f.read())
         self.assertEqual(graph.get_open_reviews('1288393'), [113009])
Beispiel #4
0
 def test_get_open_reviews_empty(self):
     with mock.patch('requests.get') as mock_get:
         mock_get.return_value = FakeResponse("[]\n")
         self.assertEqual(graph.get_open_reviews('1353131'), [])