'A resource record of unknown type and class is parsed into an
L{UnknownRecord} instance with its data preserved, and an
L{UnknownRecord} instance is serialized to a string equal to the one it
was parsed from.'

def test_unknown(self):

    wire = '\x01\x00\x00\x00\x00\x01\x00\x01\x00\x00\x00\x01\x03foo\x03bar\x00\xde\xad\xbe\xef\xc0\x0c\xde\xad\xbe\xef\x00\x00\x01\x01\x00\x08somedata\x03baz\x03ban\x00\x00\x01\x00\x01\x00\x00\x01\x01\x00\x04\x01\x02\x03\x04'
    msg = dns.Message()
    msg.fromStr(wire)
    self.assertEqual(msg.queries, [dns.Query('foo.bar', type=57005, cls=48879)])
    self.assertEqual(msg.answers, [dns.RRHeader('foo.bar', type=57005, cls=48879, ttl=257, payload=dns.UnknownRecord('somedata', ttl=257))])
    self.assertEqual(msg.additional, [dns.RRHeader('baz.ban', type=dns.A, cls=dns.IN, ttl=257, payload=dns.Record_A('1.2.3.4', ttl=257))])
    enc = msg.toStr()
    self.assertEqual(enc, wire)
