Exemplo n.º 1
0
def _dns_create_record(form, request, device):
    if form.cleaned_data.get('dns_new_content'):
        record = Record()
        _dns_fill_record(form, 'dns_new_', record, request)
        record.saving_user = request.user
        record.saving_device = device
        record.save()
        messages.success(request, "A DNS record added.")
Exemplo n.º 2
0
def _dns_create_record(form, request, device):
    if form.cleaned_data.get('dns_new_content'):
        record = Record()
        _dns_fill_record(form, 'dns_new_', record, request)
        record.saving_user = request.user
        record.saving_device = device
        record.save()
        messages.success(request, "A DNS record added.")
Exemplo n.º 3
0
 def test_record_delete(self):
     record = Record(
         name='hostname.example.com',
         type='A',
         content='127.0.0.1',
         domain=self.domain,
     )
     record.saving_user = self.user
     record.save()
     DNSHistory.objects.all().delete()
     record.delete()
     history = DNSHistory.objects.get(
         record_name='hostname.example.com',
         field_name='delete',
         user=self.user,
     )
     self.assertEqual(history.old_value, '127.0.0.1')
     self.assertEqual(history.new_value, '')
Exemplo n.º 4
0
 def test_record_delete(self):
     record = Record(
         name='hostname.example.com',
         type='A',
         content='127.0.0.1',
         domain=self.domain,
     )
     record.saving_user = self.user
     record.save()
     DNSHistory.objects.all().delete()
     record.delete()
     history = DNSHistory.objects.get(
         record_name='hostname.example.com',
         field_name='delete',
         user=self.user,
     )
     self.assertEqual(history.old_value, '127.0.0.1')
     self.assertEqual(history.new_value, '')