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


Python utils.random_label函数代码示例

本文整理汇总了Python中mozdns.tests.utils.random_label函数的典型用法代码示例。如果您正苦于以下问题:Python random_label函数的具体用法?Python random_label怎么用?Python random_label使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: post_data

 def post_data(self):
     return {
         'description': random_label(),
         'ttl': random_byte(),
         'fqdn': 'f' + random_label() + "." + self.domain.name,
         'txt_data': random_label()
     }
开发者ID:caseybecking,项目名称:inventory,代码行数:7,代码来源:basic.py

示例2: post_data

 def post_data(self):
     return {
         # We are fucking this up on purpose.
         'fuckinup': random_label(),
         'fqdn': gt(random_label() + '.' + random_label() + '.' +
                    self.domain.name),
     }
开发者ID:caseybecking,项目名称:inventory,代码行数:7,代码来源:ptr.py

示例3: post_data

 def post_data(self):
     return {
         'operating_system': self.operating_system.pk,
         'server_model': self.server_model.pk,
         'allocation': self.allocation.pk,
         'system_rack': self.system_rack.pk,
         'system_type': self.system_type.pk,
         'system_status': self.system_status.pk,
         'hostname': '{0}.{1}.mozilla.com'.format(
             random_label(), random_label()
         ),
         'serial': '1234',
         'oob_ip': '10.2.3.4',
         'asset_tag': 'foobar',
         'notes': 'foobar notes',
         'rack_order': '1.21',
         'switch_ports': 'hihi',
         'patch_panel_port': 'derpdaderp',
         'oob_switch_port': 'derpdaderp',
         'purchase_date': '2012-08-01',
         'purchase_price': '$3000',
         'change_password': self.change_password_date.isoformat(),
         'warranty_start': '2012-08-01',
         'warranty_end': '2012-08-04'
     }
开发者ID:Marlburo,项目名称:inventory,代码行数:25,代码来源:basic.py

示例4: get_domain_and_post_data

 def get_domain_and_post_data(self):
     # This is different for classes that have ips instead of fqdns
     domain_name = "{0}.{1}.{2}.{3}.com".format(
         random_label(), random_label(), random_label(), random_label()
     )
     root_domain = create_fake_zone(domain_name, suffix="")
     post_data = self.post_data()
     # Get the '_' in SRV records
     post_data['fqdn'] = post_data['fqdn'][0] + "asdf.asdf." + domain_name
     return root_domain, post_data
开发者ID:caseybecking,项目名称:inventory,代码行数:10,代码来源:basic.py

示例5: build_sample_domain

def build_sample_domain():
    domain_name = ''
    for i in range(2):
        domain_name = random_label()
        domain = Domain(name=domain_name)
    soa = SOA(
        primary=random_label(), contact="asf", description=random_label())
    soa.save()
    domain.soa = soa
    domain.save()
    return domain
开发者ID:caseybecking,项目名称:inventory,代码行数:11,代码来源:ptr.py

示例6: post_data

 def post_data(self):
     return {
         'description': random_label(),
         'ttl': random_byte(),
         'interface_name': 'eth0',
         'fqdn': 'sreg' + random_label() + "." + self.domain.name,
         'ip_str': "4.{0}.{1}.{2}".format(
             random_byte(), random_byte(), random_byte()),
         'ip_type': '4',
         'system': self.system.pk,
         'mac': '00:11:22:33:44:55'
     }
开发者ID:Marlburo,项目名称:inventory,代码行数:12,代码来源:tests.py

示例7: setUp

    def setUp(self):
        self.rdtype = self.test_type().rdtype
        self.create_url = "{0}/create/{1}/".format(self.record_base_url,
                                                   self.rdtype)
        self.update_url_template = self.create_url + "{1}/"

        self.c = Client()
        self.factory = RequestFactory()
        self.domain = create_fake_zone("{0}.{1}.{2}".format(random_label(),
                                       random_label(), random_label()))
        self.public_view = View.objects.get_or_create(name='public')[0]
        self.private_view = View.objects.get_or_create(name='private')[0]
开发者ID:rtucker-mozilla,项目名称:mozilla_inventory,代码行数:12,代码来源:tests.py

示例8: post_data

 def post_data(self):
     return {
         'description': 'm' + random_label(),
         'ttl': random_byte(),
         'mac': '11:22:33:44:55:00',
         'system': '/tasty/v3/system/{0}/'.format(self.s.pk),
         'fqdn': 'a' + random_label() + "." + self.domain.name,
         'iname': 'eth2.4',
         'dhcp_enabled': False,
         'dns_enabled': True,
         'ip_str': "11.255.{0}.{1}".format(random_byte(), random_byte()),
         'ip_type': '4'
     }
开发者ID:rtucker-mozilla,项目名称:mozilla_inventory,代码行数:13,代码来源:basic.py

示例9: get_post_data

 def get_post_data(self):
     """Return a valid set of data"""
     return {
         'root_domain': '{0}.{0}.mozilla.com'.format(
         random_label() + random_label()),
         'soa_primary': 'ns1.mozilla.com',
         'soa_contact': 'noc.mozilla.com',
         'nameserver_1': 'ns1.mozilla.com',
         'nameserver_2': 'ns2.mozilla.com',
         'nameserver_3': 'ns3.mozilla.com',
         'ttl_1': random_byte(),
         'ttl_2': random_byte(),
         'ttl_3': random_byte(),
     }
开发者ID:rtucker-mozilla,项目名称:mozilla_inventory,代码行数:14,代码来源:tests.py

示例10: test_fqdn_create

 def test_fqdn_create(self):
     if self.test_type == Nameserver:
         return  # Nameservers don't get this test.
     obj_data = self.post_data()
     label = obj_data.pop('label')
     domain = random_label(
     ) + '.' + random_label() + '.' + obj_data.pop('domain')
     obj_data['fqdn'] = label + '.' + domain
     resp, post_data = self.generic_create(obj_data)
     _, _, (_, new_object_url) = resp.items()
     new_resp = self.api_client.get(new_object_url, format='json')
     self.assertValidJSONResponse(new_resp)
     new_obj_data = json.loads(new_resp.content)
     self.assertEqual(label, new_obj_data['label'])
     self.assertEqual(domain, new_obj_data['domain'])
开发者ID:caseybecking,项目名称:inventory,代码行数:15,代码来源:ptr.py

示例11: test_more_realistic_creation

    def test_more_realistic_creation(self):
        # create a zone
        post_data = self.get_post_data()
        resp = self.c.post(localize(reverse('create-zone-ajax')), post_data)
        self.assertEqual(200, resp.status_code)
        first_root_domain = post_data['root_domain']
        self._check_domain_tree(first_root_domain)

        # Now create a new zone under the created zone.
        # Make sure the tree under the new zone is preserved.

        second_root_domain = "{0}.{1}".format(
            random_label(), first_root_domain
        )
        post_data['root_domain'] = second_root_domain
        resp = self.c.post(localize(reverse('create-zone-ajax')), post_data)
        self.assertEqual(200, resp.status_code)
        self._check_domain_tree(first_root_domain)
        self.assertTrue(Domain.objects.filter(name=second_root_domain))
        root_domain = Domain.objects.get(name=second_root_domain)
        self.assertFalse(root_domain.purgeable)
        self.assertFalse(root_domain.master_domain.purgeable)

        self.assertNotEqual(None, root_domain.soa)
        self.assertFalse(None, root_domain.master_domain.soa)
开发者ID:Marlburo,项目名称:inventory,代码行数:25,代码来源:tests.py

示例12: get_post_data

 def get_post_data(self):
     """Return a valid set of data"""
     return {
         "root_domain": "{0}.{0}.mozilla.com".format(random_label() + random_label()),
         "soa_primary": "ns1.mozilla.com",
         "soa_contact": "noc.mozilla.com",
         "nameserver_1": "ns1.mozilla.com",
         "nameserver_2": "ns2.mozilla.com",
         "nameserver_3": "ns3.mozilla.com",
         "ttl_1": random_byte(),
         "ttl_2": random_byte(),
         "ttl_3": random_byte(),
         "private_view_1": "on",
         "private_view_2": "on",
         "private_view_3": "",
         "public_view_1": "on",
         "public_view_2": "",
         "public_view_3": "on",
     }
开发者ID:rhelmer,项目名称:inventory,代码行数:19,代码来源:tests.py

示例13: post_data

 def post_data(self):
     return {
         'key': random_label(),
         'value': random_label(),
     }
开发者ID:rtucker-mozilla,项目名称:mozilla_inventory,代码行数:5,代码来源:kv.py


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