'Test to check the impact of snat_namespace object.
This function specifically checks the impact of the snat
namespace object initialization without the actual creation
of snat_namespace. When deletes are issued to the snat
namespace based on the snat namespace object existence, it
should be checking for the valid namespace existence before
it tries to delete.'

@mock.patch.object(namespaces.Namespace, 'delete')
def test_snat_ns_delete_not_called_when_snat_namespace_does_not_exist(self, mock_ns_del):

    router = l3_test_common.prepare_router_data(num_internal_ports=2)
    self._set_ri_kwargs(mock.Mock(), router['id'], router)
    ri = dvr_router.DvrEdgeRouter(HOSTNAME, **self.ri_kwargs)
    self.mock_ip.netns.exists.return_value = False
    self.assertIsNotNone(ri.snat_namespace)
    (interface_name, ex_gw_port) = l3_test_common.prepare_ext_gw_test(self, ri)
    ri._external_gateway_removed = mock.Mock()
    ri.external_gateway_removed(ex_gw_port, interface_name)
    self.assertFalse(mock_ns_del.called)
