def test_unpack(self): """Test if unpack fails""" controller = Controller(address='unix:abstract=abcde') controller.establish_connection = Mock(return_value=None) controller.connection = MockConnection(True) with pytest.raises(ConnectionReturnError): controller.new_record()
def new_record(self): """Create a Controller object and call new_record method""" res = [] controller = Controller() for _ in range(self.NUM * self.FACTOR): res.append(controller.new_record()) return res
def test_action_fails(self): """Test what happens if the requested action fails""" controller = Controller(address='unix:abstract=abcde') controller.establish_connection = Mock(return_value=None) controller.connection = MockConnection(return_variant=True, should_fail=True) assert controller.new_record() is False
def test_action_fails(self): """Test what happens if the requested action fails""" controller = Controller(address='unix:abstract=abcde') controller.establish_connection = Mock(return_value=None) controller.connection = MockConnection( return_variant=True, should_fail=True) assert controller.new_record() is False
def test_normal_unpack(self): """Test if valid""" controller = Controller(address='unix:abstract=abcdef') controller.establish_connection = Mock(return_value=None) controller.connection = MockConnection(False) assert controller.new_record() is True