def test_close(self): connection = Mock() sender = Mock() receiver = Mock() method = Method('', '', {}) method.connection = connection method.sender = sender method.receiver = receiver # test method.close() # validation receiver.close.assert_called_once_with() sender.close.assert_called_once_with()
def test_repair(self, _connection, uuid): url = 'url-test' uuid.return_value = '5138' connection = Mock() _connection.return_value = connection sender = Mock() sender.close.side_effect = ValueError receiver = Mock() receiver.close.side_effect = ValueError connection.receiver.return_value = receiver connection.sender.return_value = sender # test method = Method(url, '', {}) method.close = Mock() method.repair() # validation method.close.assert_called_once_with() connection.close.assert_called_once_with() connection.open.assert_called_once_with() connection.sender.assert_called_once_with(model.ADDRESS) connection.receiver.assert_called_once_with(model.ADDRESS, dynamic=True) self.assertEqual(method.connection, connection) self.assertEqual(method.sender, sender) self.assertEqual(method.receiver, receiver)
def test_repair(self, _connection, uuid): url = "url-test" uuid.return_value = "5138" connection = Mock() _connection.return_value = connection sender = Mock() sender.close.side_effect = ValueError receiver = Mock() receiver.close.side_effect = ValueError connection.receiver.return_value = receiver connection.sender.return_value = sender # test method = Method(url, "", {}) method.close = Mock() method.repair() # validation method.close.assert_called_once_with() connection.close.assert_called_once_with() connection.open.assert_called_once_with() connection.sender.assert_called_once_with(model.ADDRESS) connection.receiver.assert_called_once_with(model.ADDRESS, dynamic=True) self.assertEqual(method.connection, connection) self.assertEqual(method.sender, sender) self.assertEqual(method.receiver, receiver)
def test_close(self): connection = Mock() sender = Mock() receiver = Mock() method = Method("", "", {}) method.connection = connection method.sender = sender method.receiver = receiver sender.close.side_effect = ValueError receiver.close.side_effect = ValueError # test method.close() # validation receiver.close.assert_called_once_with() sender.close.assert_called_once_with()