Exemple #1
0
 def post_data(self):
     return {
         'server': 'g' + random_label(),
         'comment': random_label(),
         'ttl': random_byte(),
         'domain': self.domain.name,
     }
Exemple #2
0
 def post_data(self):
     return {
         'comment':
         random_label(),
         'ttl':
         random_byte(),
         'label':
         'p' + random_label(),
         'iname':
         'mgmt4',
         'dhcp_enabled':
         True,
         'dns_enabled':
         True,
         'mac':
         '11:22:33:44:55:00',
         'system':
         '/tasty/systems/system/{0}/'.format(self.s.pk),
         'domain':
         self.domain.name,
         'ip_str':
         "2000:a{0}:a{1}:a{2}::".format(random_byte(), random_byte(),
                                        random_byte()),
         'ip_type':
         '6'
     }
Exemple #3
0
 def post_data(self):
     return {
         'server': 'g' + random_label(),
         'comment': random_label(),
         'ttl': random_byte(),
         'domain': self.domain.name,
     }
Exemple #4
0
 def post_data(self):
     return {
         'description': random_label(),
         'ttl': random_byte(),
         'fqdn': 'f' + random_label() + "." + self.domain.name,
         'txt_data': random_label()
     }
Exemple #5
0
 def post_data(self):
     return {
         # We are f*****g this up on purpose.
         'fuckinup': random_label(),
         'fqdn': "c{0}.{1}.{2)}".format(random_label(), random_label(),
                                        self.domain.name),
     }
Exemple #6
0
 def test_SRV(self):
     data = {'rtype': 'SRV'}
     data.update({'target': random_label()})
     data.update(self.craft_label_domain())
     data['label'] = "_" + random_label()
     data.update(self.craft_ttl_and_description())
     data.update(self.craft_number_dict('priority'))
     data.update(self.craft_number_dict('weight'))
     data.update(self.craft_number_dict('port'))
     data.update(self.craft_name_dict('target'))
     request = FakeRequest(json.dumps(data))
     response = commit_record(request)
     self.assertFalse('errors' in response.content)
     self.assertTrue(response.status_code, 200)
     content = json.loads(response.content)
     self.validate_return_object(content['obj_class'], content['obj_pk'],
                                 data)
     # Now do an update
     orig_obj_pk = content['obj_pk']
     data['pk'] = orig_obj_pk
     data.update(self.craft_label_domain())
     data['label'] = "_" + random_label()
     request = FakeRequest(json.dumps(data))
     response = commit_record(request)
     self.validate_return_object(content['obj_class'], content['obj_pk'],
                                 data)
     self.assertEqual(orig_obj_pk, content['obj_pk'])
Exemple #7
0
 def test_SRV(self):
     data = {'rtype': 'SRV'}
     data.update({'target': random_label()})
     data.update(self.craft_label_domain())
     data['label'] = "_" + random_label()
     data.update(self.craft_ttl_and_comment())
     data.update(self.craft_number_dict('priority'))
     data.update(self.craft_number_dict('weight'))
     data.update(self.craft_number_dict('port'))
     data.update(self.craft_name_dict('target'))
     request = FakeRequest(json.dumps(data))
     response = commit_record(request)
     self.assertFalse('errors' in response.content)
     self.assertTrue(response.status_code, 200)
     content = json.loads(response.content)
     self.validate_return_object(content['obj_class'],
                                 content['obj_pk'], data)
     # Now do an update
     orig_obj_pk = content['obj_pk']
     data['pk'] = orig_obj_pk
     data.update(self.craft_label_domain())
     data['label'] = "_" + random_label()
     request = FakeRequest(json.dumps(data))
     response = commit_record(request)
     self.validate_return_object(content['obj_class'],
                                 content['obj_pk'], data)
     self.assertEqual(orig_obj_pk, content['obj_pk'])
Exemple #8
0
 def post_data(self):
     return {
         'comment': random_label(),
         'ttl': random_byte(),
         'ip_str': "11.{0}.{1}.{2}".format(random_byte(), random_byte(), random_byte()),
         'ip_type': '4',
         'name': random_label()
     }
Exemple #9
0
 def post_data(self):
     return {
         'comment': random_label(),
         'ttl': random_byte(),
         'label': 'f' + random_label(),
         'domain': self.domain.name,
         'txt_data': random_label()
     }
Exemple #10
0
 def post_data(self):
     return {
         'comment': random_label(),
         'ttl': random_byte(),
         'label': 'f' + random_label(),
         'domain': self.domain.name,
         'txt_data': random_label()
     }
Exemple #11
0
 def post_data(self):
     return {
         'comment': random_label(),
         'ttl': random_byte(),
         'label': 'i' + random_label(),
         'domain': self.domain.name,
         'ip_str': "11.{0}.{1}.{2}".format(random_byte(), random_byte(), random_byte()),
         'ip_type': '4'
     }
Exemple #12
0
 def post_data(self):
     return {
         # We are f*****g this up on purpose.
         'fuckinup':
         random_label(),
         'fqdn':
         'c' + random_label() + '.' + random_label() + '.' +
         self.domain.name,
     }
Exemple #13
0
 def post_data(self):
     return {
         'description': random_label(),
         'ttl': random_byte(),
         'ip_str': "11.{0}.{1}.{2}".format(
             random_byte(), random_byte(), random_byte()),
         'ip_type': '4',
         'name': random_label()
     }
Exemple #14
0
 def post_data(self):
     return {
         'description': random_label(),
         'ttl': random_byte(),
         'fqdn': 'j' + random_label() + "." + self.domain.name,
         'ip_str': "1000:{0}:{1}:{2}::".format(random_byte(), random_byte(),
                                               random_byte()),
         'ip_type': '6'
     }
Exemple #15
0
 def post_data(self):
     return {
         'description': random_label(),
         'ttl': random_byte(),
         'fqdn': 'i' + random_label() + "." + self.domain.name,
         'ip_str': "11.{0}.{1}.{2}".format(
             random_byte(), random_byte(), random_byte()),
         'ip_type': '4'
     }
Exemple #16
0
 def post_data(self):
     return {
         'description': random_label(),
         'ttl': random_byte(),
         'fqdn': 'h' + random_label() + "." + self.domain.name,
         'algorithm_number': 1,
         'fingerprint_type': 1,
         'key': random_label()
     }
Exemple #17
0
 def post_data(self):
     return {
         'comment': random_label(),
         'ttl': random_byte(),
         'label': random_label(),
         'domain': self.domain.name,
         'ip_str': "11.{0}.{1}.{2}".format(random_byte(), random_byte(), random_byte()),
         'ip_type': '4'
     }
Exemple #18
0
 def post_data(self):
     return {
         'description': random_label(),
         'ttl': random_byte(),
         'fqdn':  'e' + random_label() + "." + self.domain.name,
         'server': random_label(),
         'priority': 123,
         'ttl': 213
     }
Exemple #19
0
 def post_data(self):
     return {
         'comment': random_label(),
         'ttl': random_byte(),
         'label': random_label(),
         'domain': self.domain.name,
         'ip_str': "1000:{0}:{1}:{2}::".format(random_byte(), random_byte(),
                                               random_byte()),
         'ip_type': '6'
     }
Exemple #20
0
 def post_data(self):
     return {
         'description': 'k' + random_label(),
         'ttl': random_byte(),
         'ip_str': "1000:{0}:{1}:{2}:{3}:{4}::".format(
             random_byte(), random_byte(), random_byte(), random_byte(),
             random_byte()),
         'ip_type': '6',
         'name': random_label()
     }
Exemple #21
0
 def post_data(self):
     return {
         'description': random_label(),
         'ttl': random_byte(),
         'fqdn': "_" + random_label() + "." + self.domain.name,
         'target': random_label(),
         'priority': 2,
         'weight': 2222,
         'port': 222
     }
Exemple #22
0
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", comment=random_label())
    soa.save()
    domain.soa = soa
    domain.save()
    return domain
Exemple #23
0
 def post_data(self):
     return {
         'comment': random_label(),
         'ttl': random_byte(),
         'label': 'j' + random_label(),
         'domain': self.domain.name,
         'ip_str': "1000:{0}:{1}:{2}::".format(random_byte(), random_byte(),
                                               random_byte()),
         'ip_type': '6'
     }
Exemple #24
0
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", comment=random_label())
    soa.save()
    domain.soa = soa
    domain.save()
    return domain
Exemple #25
0
 def post_data(self):
     return {
         'comment': random_label(),
         'ttl': random_byte(),
         'label': 'h' + random_label(),
         'domain': self.domain.name,
         'algorithm_number': 1,
         'fingerprint_type': 1,
         'key': random_label()
     }
Exemple #26
0
 def post_data(self):
     return {
         'comment': random_label(),
         'ttl': random_byte(),
         'label': 'e' + random_label(),
         'domain': self.domain.name,
         'server': random_label(),
         'priority': 123,
         'ttl': 213
     }
Exemple #27
0
 def post_data(self):
     return {
         'comment': random_label(),
         'ttl': random_byte(),
         'label': 'h' + random_label(),
         'domain': self.domain.name,
         'algorithm_number': 1,
         'fingerprint_type': 1,
         'key': random_label()
     }
Exemple #28
0
 def post_data(self):
     return {
         'comment': random_label(),
         'ttl': random_byte(),
         'label': 'e' + random_label(),
         'domain': self.domain.name,
         'server': random_label(),
         'priority': 123,
         'ttl': 213
     }
Exemple #29
0
 def post_data(self):
     return {
         'comment': random_label(),
         'ttl': random_byte(),
         'label': "_" + random_label(),
         'domain': self.domain.name,
         'target': random_label(),
         'priority': 2,
         'weight': 2222,
         'port': 222
     }
Exemple #30
0
 def post_data(self):
     return {
         'comment': random_label(),
         'ttl': random_byte(),
         'label': "_" + random_label(),
         'domain': self.domain.name,
         'target': random_label(),
         'priority': 2,
         'weight': 2222,
         'port': 222
     }
Exemple #31
0
 def test_fqdn_create(self):
     obj_data = self.post_data()
     label = obj_data.pop('label')
     domain = random_label() + '.' + str(self.test_type.__name__) + '.' + 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'])
Exemple #32
0
 def post_data(self):
     return {
         'comment': 'm' + random_label(),
         'ttl': random_byte(),
         'mac': '11:22:33:44:55:00',
         'system': '/tasty/systems/system/{0}/'.format(self.s.pk),
         'label': 'a' + random_label(),
         'iname': 'eth2.4',
         'dhcp_enabled': False,
         'dns_enabled': True,
         'domain': self.domain.name,
         'ip_str': "11.255.{0}.{1}".format(random_byte(), random_byte()),
         'ip_type': '4'
     }
Exemple #33
0
 def post_data(self):
     return {
         'comment': 'm' + random_label(),
         'ttl': random_byte(),
         'mac': '11:22:33:44:55:00',
         'system': '/tasty/systems/system/{0}/'.format(self.s.pk),
         'label': 'a' + random_label(),
         'iname': 'eth2.4',
         'dhcp_enabled': False,
         'dns_enabled': True,
         'domain': self.domain.name,
         'ip_str': "11.255.{0}.{1}".format(random_byte(), random_byte()),
         'ip_type': '4'
     }
Exemple #34
0
 def test_fqdn_create(self):
     obj_data = self.post_data()
     label = obj_data.pop('label')
     domain = random_label() + '.' + str(
         self.test_type.__name__) + '.' + 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'])
Exemple #35
0
 def post_data(self):
     return {
         'comment': random_label(),
         'ttl': random_byte(),
         'label': 'p' + random_label(),
         'iname': 'mgmt4',
         'dhcp_enabled': True,
         'dns_enabled': True,
         'mac': '11:22:33:44:55:00',
         'system': '/tasty/systems/system/{0}/'.format(self.s.pk),
         'domain': self.domain.name,
         'ip_str': "2000:a{0}:a{1}:a{2}::".format(random_byte(), random_byte(),
                                                  random_byte()),
         'ip_type': '6'
     }
Exemple #36
0
 def test_PTR(self):
     data = {'rtype': 'PTR'}
     data.update({'name': random_label()})
     data.update(self.craft_ip_str())
     data.update(self.craft_ttl_and_comment())
     request = FakeRequest(json.dumps(data))
     response = commit_record(request)
     self.assertFalse('errors' in response.content)
     self.assertTrue(response.status_code, 200)
     content = json.loads(response.content)
     self.validate_return_object(content['obj_class'],
                                 content['obj_pk'], data)
     # Now do an update
     orig_obj_pk = content['obj_pk']
     data['pk'] = orig_obj_pk
     data.update(self.craft_ip_str())
     request = FakeRequest(json.dumps(data))
     response = commit_record(request)
     self.validate_return_object(content['obj_class'],
                                 content['obj_pk'], data)
     self.assertEqual(orig_obj_pk, content['obj_pk'])
Exemple #37
0
 def test_PTR(self):
     data = {'rtype': 'PTR'}
     data.update({'name': random_label()})
     data.update(self.craft_ip_str())
     data.update(self.craft_ttl_and_description())
     request = FakeRequest(json.dumps(data))
     response = commit_record(request)
     self.assertFalse('errors' in response.content)
     self.assertTrue(response.status_code, 200)
     content = json.loads(response.content)
     self.validate_return_object(content['obj_class'], content['obj_pk'],
                                 data)
     # Now do an update
     orig_obj_pk = content['obj_pk']
     data['pk'] = orig_obj_pk
     data.update(self.craft_ip_str())
     request = FakeRequest(json.dumps(data))
     response = commit_record(request)
     self.validate_return_object(content['obj_class'], content['obj_pk'],
                                 data)
     self.assertEqual(orig_obj_pk, content['obj_pk'])
Exemple #38
0
 def craft_ttl_and_description(self):
     data = {
         'ttl': random_byte(),
         'description': random_label()
     }
     return data
Exemple #39
0
 def post_data(self):
     return {
         # We are f*****g this up on purpose.
         'fuckinup': random_label(),
         'fqdn': 'c' + random_label() + '.' + random_label() + '.' + self.domain.name,
     }
Exemple #40
0
 def craft_name_dict(self, field):
     data = {field: random_label() + "." + random_label()}
     return data
Exemple #41
0
 def craft_label_domain(self):
     data = {
         'label': random_label(),
         'domain': self.d.name
     }
     return data
Exemple #42
0
 def craft_label_domain(self):
     data = {'label': random_label(), 'domain': self.d.name}
     return data
Exemple #43
0
 def craft_name_dict(self, field):
     data = {field: random_label() + "." + random_label()}
     return data
Exemple #44
0
 def craft_ttl_and_comment(self):
     data = {
         'ttl': random_byte(),
         'comment': random_label()
     }
     return data
Exemple #45
0
 def craft_ttl_and_description(self):
     data = {'ttl': random_byte(), 'description': random_label()}
     return data
Exemple #46
0
 def post_data(self):
     return {
         'key': random_label(),
         'value': random_label(),
     }