当前位置: 首页>>代码示例>>Python>>正文


Python Domain.delegated方法代码示例

本文整理汇总了Python中mozdns.domain.models.Domain.delegated方法的典型用法代码示例。如果您正苦于以下问题:Python Domain.delegated方法的具体用法?Python Domain.delegated怎么用?Python Domain.delegated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mozdns.domain.models.Domain的用法示例。


在下文中一共展示了Domain.delegated方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_delegation

# 需要导入模块: from mozdns.domain.models import Domain [as 别名]
# 或者: from mozdns.domain.models.Domain import delegated [as 别名]
    def test_delegation(self):
        name = "boom"
        dom = Domain(name=name, delegated=True)
        dom.save()

        # Creating objects in the domain should be locked.
        arec = AddressRecord(label="ns1", domain=dom, ip_str="128.193.99.9",
                             ip_type='4')
        self.assertRaises(ValidationError, arec.save)

        ns = Nameserver(domain=dom, server="ns1." + dom.name)
        self.assertRaises(ValidationError, ns.save)

        cn = CNAME(label="999asdf", domain=dom, target="asdf.asdf")
        self.assertRaises(ValidationError, cn.full_clean)

        # Undelegate (unlock) the domain.
        dom.delegated = False
        dom.save()

        # Add glue and ns record.
        arec.save()
        ns.save()

        # Re delegate the domain.
        dom.delegated = True
        dom.save()

        # Creation should still be locked
        arec1 = AddressRecord(
            label="ns2", domain=dom, ip_str="128.193.99.9", ip_type='4')
        self.assertRaises(ValidationError, arec1.save)

        cn1 = CNAME(label="1000asdf", domain=dom, target="asdf.asdf")
        self.assertRaises(ValidationError, cn1.full_clean)

        # Editing should be allowed.
        arec = AddressRecord.objects.get(pk=arec.pk)
        arec.ip_str = "129.193.88.2"
        arec.save()

        # Adding new A records that have the same name as an NS should
        # be allowed.
        arec1 = AddressRecord(label="ns1", domain=dom, ip_str="128.193.100.10",
                              ip_type='4')
        arec1.save()
开发者ID:caseybecking,项目名称:inventory,代码行数:48,代码来源:basic.py

示例2: test_delegation_block

# 需要导入模块: from mozdns.domain.models import Domain [as 别名]
# 或者: from mozdns.domain.models.Domain import delegated [as 别名]
    def test_delegation_block(self):
        s, _ = SOA.objects.get_or_create(primary="foo", contact="Foo",
                                         description="foo")
        c = Domain(name='com')
        c.soa = s
        c.save()
        self.assertFalse(c.purgeable)
        f_c = Domain(name='foo.com')
        f_c.delegated = True
        f_c.save()
        self.assertFalse(f_c.purgeable)
        self.assertTrue(f_c.delegated)

        fqdn = "z.baz.foo.com"
        self.assertRaises(ValidationError, ensure_label_domain, fqdn)
开发者ID:Marlburo,项目名称:inventory,代码行数:17,代码来源:auto_create.py


注:本文中的mozdns.domain.models.Domain.delegated方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。