當前位置: 首頁>>代碼示例>>Python>>正文


Python AddressRecord.label方法代碼示例

本文整理匯總了Python中cyder.cydns.address_record.models.AddressRecord.label方法的典型用法代碼示例。如果您正苦於以下問題:Python AddressRecord.label方法的具體用法?Python AddressRecord.label怎麽用?Python AddressRecord.label使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cyder.cydns.address_record.models.AddressRecord的用法示例。


在下文中一共展示了AddressRecord.label方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_invalid_update_to_existing

# 需要導入模塊: from cyder.cydns.address_record.models import AddressRecord [as 別名]
# 或者: from cyder.cydns.address_record.models.AddressRecord import label [as 別名]
    def test_invalid_update_to_existing(self):
        rec1 = AddressRecord(label='bar', domain=self.z_o_e,
                             ip_str="128.193.40.1", ip_type='4')
        rec2 = AddressRecord(label='bar', domain=self.z_o_e,
                             ip_str="128.193.40.2", ip_type='4')
        rec3 = AddressRecord(label='foo', domain=self.z_o_e,
                             ip_str="128.193.40.1", ip_type='4')
        rec3.save()
        rec2.save()
        rec1.save()

        rec1.label = "foo"
        self.assertRaises(ValidationError, rec1.save)

        rec3.label = "bar"
        self.assertRaises(ValidationError, rec3.save)

        osu_block = "633:105:F000:"
        rec1 = AddressRecord(label='bar', domain=self.z_o_e,
                             ip_str=osu_block + ":1", ip_type='6')
        rec2 = AddressRecord(label='bar', domain=self.z_o_e,
                             ip_str=osu_block + ":2", ip_type='6')
        rec3 = AddressRecord(label='foo', domain=self.z_o_e,
                             ip_str=osu_block + ":1", ip_type='6')
        rec1.save()
        rec2.save()
        rec3.save()

        rec2.ip_str = osu_block + ":1"
        self.assertRaises(ValidationError, rec2.save)

        rec3.label = 'bar'
        self.assertRaises(ValidationError, rec3.save)
開發者ID:Ziaunys,項目名稱:chili,代碼行數:35,代碼來源:test_models.py

示例2: test_no_update_when_glue

# 需要導入模塊: from cyder.cydns.address_record.models import AddressRecord [as 別名]
# 或者: from cyder.cydns.address_record.models.AddressRecord import label [as 別名]
    def test_no_update_when_glue(self):
        """A record shouldn't update it's label or domain when it is a glue record"""
        label = 'ns99'
        glue = AddressRecord(label=label, domain=self.o_e,
                             ip_str='128.193.1.10', ip_type='4')
        glue.save()

        server = "%s.%s" % (label, self.o_e)
        ns = Nameserver(domain=self.o_e, server=server)
        ns.save()
        self.assertTrue(ns.glue == glue)

        # Shouldn't be able to edit label or domain.
        glue.label = "ns100"
        self.assertRaises(ValidationError, glue.save)
        glue.domain = self.m_o_e
        self.assertRaises(ValidationError, glue.save)

        glue = AddressRecord.objects.get(pk=glue.pk)
        glue.label = "ns101"
        glue.domain = self.e
        self.assertRaises(ValidationError, glue.save)

        # Ip can change.
        glue = AddressRecord.objects.get(pk=glue.pk)
        glue.ip_str = "192.192.12.12"
        glue.save()
開發者ID:Ziaunys,項目名稱:chili,代碼行數:29,代碼來源:test_models.py

示例3: test_disallow_name_update_of_glue_A

# 需要導入模塊: from cyder.cydns.address_record.models import AddressRecord [as 別名]
# 或者: from cyder.cydns.address_record.models.AddressRecord import label [as 別名]
    def test_disallow_name_update_of_glue_A(self):
        # Glue records should not be allowed to change their name.
        glue = AddressRecord(label="ns39", domain=self.f_r, ip_str="128.193.1.77", ip_type="4")
        glue.clean()
        glue.save()
        data = {"domain": self.f_r, "server": "ns39.foo.ru"}
        ns = self.do_add(**data)
        self.assertTrue(ns.glue)
        self.assertEqual(ns.glue, glue)

        glue.label = "ns22"
        self.assertRaises(ValidationError, glue.clean)
開發者ID:Ziaunys,項目名稱:chili,代碼行數:14,代碼來源:test_models.py


注:本文中的cyder.cydns.address_record.models.AddressRecord.label方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。