Exemplo n.º 1
0
 def test_edmc_ping(self, mock_post):
     mock_return = mock.Mock()
     mock_return.ok = True
     mock_return.reason = 'OK'
     mock_return.status_code = 200
     mock_post.return_value = mock_return
     resp1 = notify_edmc(EDMC_DEV, OID, ERRORS)
     self.assertTrue('OK' in resp1)
     self.assertTrue(mock_post.call_count == 1)
     mock_post.side_effect = requests.exceptions.ConnectTimeout
     resp2 = notify_edmc(EDMC_DEV, OID, ERRORS)
     self.assertTrue('timed' in resp2)
     self.assertTrue(mock_post.call_count == 2)
Exemplo n.º 2
0
 def test_edmc_ping(self, mock_post):
     mock_return = mock.Mock()
     mock_return.ok = True
     mock_return.reason = 'OK'
     mock_return.status_code = 200
     mock_post.return_value = mock_return
     resp1 = notify_edmc(EDMC_DEV, OID, ERRORS)
     self.assertTrue('OK' in resp1)
     self.assertTrue(mock_post.call_count == 1)
     mock_post.side_effect = requests.exceptions.ConnectTimeout
     resp2 = notify_edmc(EDMC_DEV, OID, ERRORS)
     self.assertTrue('timed' in resp2)
     self.assertTrue(mock_post.call_count == 2)