コード例 #1
0
 def test_txn_put_retries(self, mock_get_put_data, mock_txn_put):
     """
     Tests that the txn_put method retries on error
     """
     mock_get_put_data.return_value = (1, True)
     mock_txn_put.side_effect = [consul.base.ClientError(), {}]
     agent = ConsulAgent()
     agent.txn_put({})
コード例 #2
0
 def test_txn_put_error_after_all_retries(self, mock_get_put_data,
                                          mock_txn_put):
     """
     Tests that the txn_put method raises the exception on error after exhausting all the retries
     """
     mock_get_put_data.return_value = (1, True)
     mock_txn_put.side_effect = consul.base.ClientError
     with self.assertRaises(consul.base.ClientError):
         agent = ConsulAgent()
         agent.txn_put({})