def test_represent_answer_ptr(self): ptr_record = dns.RRHeader(payload=dns.Record_PTR(name="example.com"), type=dns.PTR) self.assertEqual(dnst.representAnswer(ptr_record), { 'hostname': 'example.com', 'answer_type': 'PTR' })
def test_represent_answer_a(self): a_record = dns.RRHeader(payload=dns.Record_A(address="1.1.1.1"), type=dns.A) self.assertEqual(dnst.representAnswer(a_record), { 'ipv4': '1.1.1.1', 'answer_type': 'A' })
def test_represent_answer_soa(self): ptr_record = dns.RRHeader(payload=dns.Record_SOA( mname='example.com', rname='foo.example.com'), type=dns.SOA) represented_answer = {} represented_answer['ttl'] = None represented_answer['answer_type'] = 'SOA' represented_answer['hostname'] = 'example.com' represented_answer['responsible_name'] = 'foo.example.com' represented_answer['serial_number'] = 0 represented_answer['refresh_interval'] = 0 represented_answer['retry_interval'] = 0 represented_answer['minimum_ttl'] = 0 represented_answer['expiration_limit'] = 0 self.assertEqual(dnst.representAnswer(ptr_record), represented_answer)
def test_represent_answer_soa(self): ptr_record = dns.RRHeader(payload=dns.Record_SOA(mname='example.com', rname='foo.example.com'), type=dns.SOA) represented_answer = {} represented_answer['ttl'] = None represented_answer['answer_type'] = 'SOA' represented_answer['hostname'] = 'example.com' represented_answer['responsible_name'] = 'foo.example.com' represented_answer['serial_number'] = 0 represented_answer['refresh_interval'] = 0 represented_answer['retry_interval'] = 0 represented_answer['minimum_ttl'] = 0 represented_answer['expiration_limit'] = 0 self.assertEqual(dnst.representAnswer(ptr_record), represented_answer)
def test_represent_answer_ptr(self): ptr_record = dns.RRHeader(payload=dns.Record_PTR(name="example.com"), type=dns.PTR) self.assertEqual(dnst.representAnswer(ptr_record), {'hostname': 'example.com', 'answer_type': 'PTR'})
def test_represent_answer_a(self): a_record = dns.RRHeader(payload=dns.Record_A(address="1.1.1.1"), type=dns.A) self.assertEqual(dnst.representAnswer(a_record), {'ipv4': '1.1.1.1', 'answer_type': 'A'})