'Test to check the impact of snat_namespace object.
This function specifically checks the impact of the snat
namespace object value on external_gateway_removed for deleting
snat_namespace when the gw_port_host mismatches or none.'

def test_ext_gw_updated_calling_snat_ns_delete_if_gw_port_host_none(self):

    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)
    with mock.patch.object(dvr_snat_ns.SnatNamespace, 'delete') as snat_ns_delete:
        (interface_name, ex_gw_port) = l3_test_common.prepare_ext_gw_test(self, ri)
        router['gw_port_host'] = ''
        ri._snat_redirect_remove = mock.Mock()
        ri.external_gateway_updated(ex_gw_port, interface_name)
        if (router['gw_port_host'] != ri.host):
            self.assertFalse(ri._snat_redirect_remove.called)
            self.assertEqual(1, snat_ns_delete.call_count)
