########################################################################
#
#  Copyright (C) 2009, CZ.NIC, z.s.p.o.
# 
#  This file is part of dnstester.
#
#  dnstester is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  dnstester is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
########################################################################

import hashlib

from testa import TestAU
from testa import TestAT
from testb import TestB
from testc import TestC
from testd import TestD
from teste import TestE
from testg import TestG

tests = [
        TestAU(0, 0, False),
        TestAU(0, 1, True),
        TestAU(0, 2, True),
        TestAU(0, 3, True),
        TestAU(1, 0, False),
        TestAU(1, 1, True),
        TestAU(1, 2, True),
        TestAU(1, 3, True),
        TestAU(2, 0, False),
        TestAU(2, 1, False),
        TestAU(2, 2, False),
        TestAU(2, 3, True),
        TestAU(3, 0, False),
        TestAU(3, 1, False),
        TestAU(3, 2, False),
        TestAU(3, 3, True),

        TestAT(0, 0),
        TestAT(0, 1),
        TestAT(0, 2),
        TestAT(0, 3),
        TestAT(1, 0),
        TestAT(1, 1),
        TestAT(1, 2),
        TestAT(1, 3),
        TestAT(2, 0),
        TestAT(2, 1),
        TestAT(2, 2),
        TestAT(2, 3),
        TestAT(3, 0),
        TestAT(3, 1),
        TestAT(3, 2),
        TestAT(3, 3),

        TestB(),

        TestC(0),
        TestC(1),

        TestD(0),
        TestD(1),

        TestE(),

        TestG(0),
        TestG(1),
        TestG(2),
        TestG(3),
        TestG(4),
    ]

def answer_digest(dns_result):
    texts = [];
    for rec in dns_result.response.answer:
        for rec2 in rec:
            texts.append(str(rec2))
    texts.sort()
    md5 = hashlib.md5()
    for txt in texts:
        md5.update(txt)
    return md5.hexdigest()



