Пример #1
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'])
Пример #2
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'])
Пример #3
0
 def test_TXT(self):
     data = {'rtype': 'A'}
     data.update(self.craft_label_domain())
     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_label_domain())
     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'])
Пример #4
0
 def test_TXT(self):
     data = {'rtype': 'A'}
     data.update(self.craft_label_domain())
     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_label_domain())
     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'])
Пример #5
0
 def test_NS(self):
     data = {'rtype': 'NS'}
     data['domain'] = self.d.name
     data.update(self.craft_ttl_and_comment())
     data.update(self.craft_name_dict('server'))
     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_name_dict('server'))
     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'])
Пример #6
0
 def test_NS(self):
     data = {'rtype': 'NS'}
     data['domain'] = self.d.name
     data.update(self.craft_ttl_and_description())
     data.update(self.craft_name_dict('server'))
     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_name_dict('server'))
     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'])