def test_unreachable_existing_route(self, execute_command): execute_command.return_value = self.ip_route_list_output route = Route('1.2.3.4/30', None) with self.assertRaises(ObjectAlreadyExistsException): route.unreachable() execute_command.assert_called_with('ip route del 1.2.3.4', namespace=None)
def step_impl(context, destination, device): route = Route(destination, device) try: route.unreachable() except Exception as e: context.exception = e
def test_unreachable_non_existing_route(self, execute_command): execute_command.return_value = self.ip_route_list_output route = Route('10.10.10.10/24', 'wlo1') route.unreachable() execute_command.assert_called_with('ip route add unreachable 10.10.10.10/24', namespace=None)