~allenap/maas/ipmi-power-confusion--bug-1560830

« back to all changes in this revision

Viewing changes to src/maasserver/models/tests/test_staticipaddress.py

  • Committer: MAAS Lander
  • Author(s): LaMont Jones
  • Date: 2016-04-25 18:06:57 UTC
  • mfrom: (4933.2.9 bug-1571621)
  • Revision ID: maas_lander-20160425180657-flyd1jupqx7ec9zk
[r=mpontillo][bug=1562919,1571621,1573690][author=lamont] Handle delegations for subdomains.  Fix the handling of fqdn in the dns apis when it refers to the top of a domain.

Show diffs side-by-side

added added

removed removed

Lines of Context:
737
737
        self.assertEqual({node.fqdn: HostnameIPMapping(
738
738
            node.system_id, 30, {phy_staticip.ip}, node.node_type)}, mapping)
739
739
 
 
740
    def test_get_hostname_ip_mapping_returns_domain_head_ips(self):
 
741
        parent = factory.make_Domain()
 
742
        name = factory.make_name()
 
743
        child = factory.make_Domain(name='%s.%s' % (name, parent.name))
 
744
        subnet = factory.make_Subnet()
 
745
        node = factory.make_Node_with_Interface_on_Subnet(
 
746
            subnet=subnet, domain=parent, hostname=name)
 
747
        sip1 = factory.make_StaticIPAddress(subnet=subnet)
 
748
        node.interface_set.first().ip_addresses.add(sip1)
 
749
        mapping = StaticIPAddress.objects.get_hostname_ip_mapping(
 
750
            parent)
 
751
        self.assertEqual({node.fqdn: HostnameIPMapping(
 
752
            node.system_id, 30, {sip1.ip}, node.node_type)}, mapping)
 
753
        mapping = StaticIPAddress.objects.get_hostname_ip_mapping(
 
754
            child)
 
755
        self.assertEqual({node.fqdn: HostnameIPMapping(
 
756
            node.system_id, 30, {sip1.ip}, node.node_type)}, mapping)
 
757
 
740
758
 
741
759
class TestStaticIPAddress(MAASServerTestCase):
742
760