#!/www/python/bin/python
"""
$URL: svn+ssh://svn.mems-exchange.org/repos/trunk/dulcinea/lib/test/utest_inquiry.py $
$Id: utest_inquiry.py 30722 2008-04-29 17:37:51Z rmasse $
"""
from dulcinea.common import CommonTest
from dulcinea.contact import Contact
from dulcinea.inquiry import Inquiry, InquiryDatabase, inquiry_re
from dulcinea.inquiry import get_inquiry_db
from dulcinea.user import get_matching_user
from qp.pub.common import get_publisher
from sancho.utest import raises

test_msg0 = '''\
From nobody@%s Thu Dec 2 15:48:08 2004
Received: (qmail 17230 invoked from network); 2 Dec 2004 20:48:00 -0000
Received: from localhost (HELO foo.default.com) (127.0.0.1)
\tby 10.27.8.146 with SMTP; 02 Dec 2004 15:48:00 -0500
Content-Type: text/plain; charset="us-ascii"
Message-ID: <mailman.5670.1139509993.27774.bar@default.com>
From: John Smith <john_smith@default.com>
Subject: Quote inquiry: from the get-a-quote form
To: inquiry@default.com

Name: John Smith
Phone: None
Email: john_smith@default.com

This is a test from the get a quote form
My wafers are 50\xc5 thick'''

test_msg1 = '''\
From nobody@%s Thu Dec 2 15:48:02 2004
Received: (qmail 17230 invoked from network); 2 Dec 2004 20:48:00 -0000
Received: from localhost (HELO foo.default.com) (127.0.0.1)
\tby 10.27.8.146 with SMTP; 02 Dec 2004 15:48:00 -0500
Content-Type: text/plain; charset="us-ascii"
X-Spam-Status: OK 0.001 
Message-ID: <mailman.5670.1139509993.27774.bar@default.com>
From: John Smith <john_smith@default.com>
Subject: Quote inquiry: from the get-a-quote form
To: inquiry@default.com

Name: John Smith
Phone: None
Email: john_smith@default.com

This is a test from the get a quote form
My wafers are 50\xc5 thick'''

test_msg2 = '''\
From nobody@%s Thu Dec 2 15:48:02 2004
Received: (qmail 17230 invoked from network); 2 Dec 2004 20:48:00 -0000
Received: from localhost (HELO foo.default.com) (127.0.0.1)
\tby 10.27.8.146 with SMTP; 02 Dec 2004 15:48:00 -0500
From: John Smith <john_smith@default.com>
Subject: Followup message #1
X-Spam-Status: UNSURE 0.45 
To: inquiry-%d@default.com
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_003A_01C20020.B53EF230"

------=_NextPart_000_003A_01C20020.B53EF230
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

This is a test for a followup to inquiry-#@domain

------=_NextPart_000_003A_01C20020.B53EF230--
'''

test_msg3 = '''\
From nobody@%s Thu Dec 2 15:48:02 2004
Received: (qmail 17230 invoked from network); 2 Dec 2004 20:48:00 -0000
Received: from localhost (HELO foo.default.com) (127.0.0.1)
\tby 10.27.8.146 with SMTP; 02 Dec 2004 15:48:00 -0500
From: Mike <mike@default.com>
Subject: Followup message
To: John Smith <john_smith@default.com>
Cc: Joe Public <joe@public.com>, inquiry-%d@default.com
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_003A_01C20020.B53EF230"

------=_NextPart_000_003A_01C20020.B53EF230
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html><body marginheight=5 topmargin=5>
<style>
body, td, font, p, div, blockquote { font-family: arial, verdana, sans-serif; }
td, font, p, div, blockquote { overflow-x: hidden; }
</style>
<font face="Arial, Verdana, sans-serif" size=2>

<p>This is a test for a followup cc inquiry-#@domain and is also MIME</p>

------=_NextPart_000_003A_01C20020.B53EF230--
'''

test_msg4 = '''\
From nobody@%s Thu Dec 2 15:48:02 2004
Received: (qmail 17230 invoked from network); 2 Dec 2004 20:48:00 -0000
Received: from localhost (HELO foo.default.com) (127.0.0.1)
\tby 10.27.8.146 with SMTP; 02 Dec 2004 15:48:00 -0500
In-Reply-To: <mailman.5670.1139509993.27774.bar@default.com>
From: Boss <boss@anywhere.com>
Subject: Quote inquiry: from the get-a-quote form
To: Worker <worker@anywhere.com>
cc: inquiry@default.com
Content-Type: text/html

Worker, please handle this, <b>--boss</b>

This test finds original inquiry via Message-ID and In-Reply-To headers
and is also text/html as a top-level content type.
'''

test_msg5 = '''\
From nobody@%s Thu Dec 2 15:48:02 2004
Received: (qmail 17230 invoked from network); 2 Dec 2004 20:48:00 -0000
Received: from localhost (HELO foo.default.com) (127.0.0.1)
\tby 10.27.8.146 with SMTP; 02 Dec 2004 15:48:00 -0500
From: Mike <mike@default.com>
Subject: Followup message
To: John Smith <john_smith@default.com>
Cc: inquiry@default.com
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_003A_01C20020.B53EF230"

Test for a badly formed multipart message.
'''

test_msg6 = '''\
From nobody@%s Thu Dec 2 15:48:02 2004
Received: (qmail 17230 invoked from network); 2 Dec 2004 20:48:00 -0000
Received: from localhost (HELO foo.default.com) (127.0.0.1)
\tby 10.27.8.146 with SMTP; 02 Dec 2004 15:48:00 -0500
From: Mike <mike@default.com>
Subject: Followup message
To: John Smith <john_smith@default.com>
Cc: inquiry@default.com
Content-Type: application/vnd.ms-excel

Message with bad content type
'''

test_msg7 = '''\
From nobody@%s Thu Dec 2 15:48:02 2004
Received: (qmail 17230 invoked from network); 2 Dec 2004 20:48:00 -0000
Received: from localhost (HELO foo.default.com) (127.0.0.1)
\tby 10.27.8.146 with SMTP; 02 Dec 2004 15:48:00 -0500
From: John Smith <john_smith@default.com>
Subject: Here is an image...
To: inquiry@default.com
Content-Type: multipart/mixed;
	boundary="----=_NextPart_000_003A_01C20020.B53EF230"

------=_NextPart_000_003A_01C20020.B53EF230
Content-Type: application/x-msdownload; name="Attachments00.HQX"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Attachments00.HQX"
    
Multipart message with no "text/plain" or "text/html" parts

------=_NextPart_000_003A_01C20020.B53EF230--
'''

test_msg8 = '''\
From nobody@%s Thu Dec 2 15:48:02 2004
Received: (qmail 15252 invoked by uid 1075); 14 Feb 2006 21:14:57 -0000
From: "John Smith" <john_smith@default.com>
MIME-Version: 1.0
Content-Type: message/rfc822
Content-Description: forwarded message
Content-Transfer-Encoding: 7bit
Message-ID: <17394.18513.390443.634648@foo.default.com>
Date: Tue, 14 Feb 2006 16:14:57 -0500
To: inquiry@default.com
Subject: forwarded message from John Smith

Content-Type: text/plain; charset=utf-8
Return-Path: <webmaster@default.com>
Delivered-To: foo@bar.default.com
Received: (qmail 19083 invoked from network); 14 Feb 2006 21:12:32 -0000
Received: from foo.default.com (HELO smtp.default.com) (10.27.8.141)
\tby 0 with SMTP; 14 Feb 2006 21:12:32 -0000
Received: (qmail 15216 invoked by alias); 14 Feb 2006 21:12:25 -0000
Delivered-To: default.com-john_smith@default.com
Received: (qmail 15214 invoked from network); 14 Feb 2006 21:12:25 -0000
Received: from foo.default.com (132.151.8.3)
\tby 10.27.8.146 with SMTP; 14 Feb 2006 16:12:25 -0500
Received: (qmail 31077 invoked by alias); 14 Feb 2006 21:12:20 -0000
Delivered-To: default.com-john_smith@default.com
Received: (qmail 31075 invoked from network); 14 Feb 2006 21:12:19 -0000
Received: from smtp.default.com (132.151.8.146)
\tby 132.151.8.3 with SMTP; 14 Feb 2006 16:12:19 -0500
Received: (qmail 15207 invoked from network); 14 Feb 2006 21:12:25 -0000
Received: from localhost (HELO foo.default.com) (127.0.0.1)
\tby 10.27.8.146 with SMTP; 14 Feb 2006 16:12:24 -0500
Message-ID: <mailman.5670.1139509993.27774.bar@default.com>
Precedence: junk
X-No-Archive: yes
From: John Smith <john_smith@default.com>
To: inquiry@default.com
Cc: John Smith <john_smith@default.com>
Subject: Quote inquiry: test

Name: John Smith
Phone: None
Email: john_smith@default.com

test for associate via forwarded message where outer message
content type is message/rfc822
'''

test_msg9 = '''\
From nobody@%s Thu Dec 2 15:48:02 2004
Received: (qmail 15366 invoked by uid 1075); 14 Feb 2006 21:30:09 -0000
From: "John Smith" <john_smith@default.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="a/WYMEaMM+"
Content-Transfer-Encoding: 7bit
Message-ID: <17394.19425.261116.680890@foo.default.com>
Date: Tue, 14 Feb 2006 16:30:09 -0500
To: john_smith@default.com
cc: inquiry@default.com
Subject: forwarded message from John Smith


--a/WYMEaMM+
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit


you take this.


--a/WYMEaMM+
Content-Type: message/rfc822
Content-Description: forwarded message
Content-Transfer-Encoding: 7bit

Content-Type: text/plain; charset=utf-8
Return-Path: <webmaster@default.com>
Delivered-To: foo@bar.default.com
Received: (qmail 19083 invoked from network); 14 Feb 2006 21:12:32 -0000
Received: from foo.default.com (HELO smtp.default.com) (10.27.8.141)
\tby 0 with SMTP; 14 Feb 2006 21:12:32 -0000
Received: (qmail 15216 invoked by alias); 14 Feb 2006 21:12:25 -0000
Delivered-To: foo.com-john_smith@default.com
Received: (qmail 15214 invoked from network); 14 Feb 2006 21:12:25 -0000
Received: from foo.default.com (132.151.8.3)
\tby 10.27.8.146 with SMTP; 14 Feb 2006 16:12:25 -0500
Received: (qmail 31077 invoked by alias); 14 Feb 2006 21:12:20 -0000
Delivered-To: default.com-john_smith@default.com
Received: (qmail 31075 invoked from network); 14 Feb 2006 21:12:19 -0000
Received: from smtp.default.com (132.151.8.146)
\tby 132.151.8.3 with SMTP; 14 Feb 2006 16:12:19 -0500
Received: (qmail 15207 invoked from network); 14 Feb 2006 21:12:25 -0000
Received: from localhost (HELO foo.default.com) (127.0.0.1)
\tby 10.27.8.146 with SMTP; 14 Feb 2006 16:12:24 -0500
Message-ID: <mailman.5670.1139509993.27774.bar@default.com>
Precedence: junk
X-No-Archive: yes
From: John Smith <john_smith@default.com>
To: inquiry@default.com
Subject: Quote inquiry: test

Name: John Smith
Phone: None
Email: john_smith@default.com

test for associate via forwarded message where outer message
content type is multipart/mixed 

--a/WYMEaMM+--
'''
test_msg10 = '''\
From nobody@badexample.org Thu Dec 2 15:48:02 2004
Received: (qmail 17230 invoked from network); 2 Dec 2004 20:48:00 -0000
Received: from localhost (HELO foo.default.com) (127.0.0.1)
\tby 10.27.8.146 with SMTP; 02 Dec 2004 15:48:00 -0500
Content-Type: text/plain; charset="us-ascii"
Message-ID: <mailman.5670.1139509993.27774.bar@default.com>
From: John Smith <john_smith@default.com>
Subject: Quote inquiry: from the get-a-quote form
To: inquiry@default.com

Name: John Smith
Phone: None
Email: john_smith@default.com

This is a test for bad unixfrom'''

test_msg11 = '''\
From nobody@%s Thu Dec 2 15:48:08 2004
Received: (qmail 17230 invoked from network); 2 Dec 2004 20:48:00 -0000
Received: from localhost (HELO foo.default.com) (127.0.0.1)
\tby 10.27.8.146 with SMTP; 02 Dec 2004 15:48:00 -0500
Content-Type: text/plain; charset="us-ascii"
Message-ID: <mailman.5670.1139509993.27774.bar@default.com>
From: John Smith <john_smith@default.com>
Subject: I%s: from the get-a-quote form
To: inquiry@default.com

Name: John Smith
Phone: None
Email: john_smith@default.com

This is a test from the get a quote form'''

test_msg12 = '''\
From nobody@%s Thu Dec 2 15:48:02 2004
Received: (qmail 17230 invoked from network); 2 Dec 2004 20:48:00 -0000
Received: from localhost (HELO foo.default.com) (127.0.0.1)
\tby 10.27.8.146 with SMTP; 02 Dec 2004 15:48:00 -0500
Content-Type: text/plain; charset="us-ascii"
X-Spam-Tags: CID
Message-ID: <mailman.5670.1139509993.27774.bar@default.com>
From: John Smith <john_smith@default.com>
Subject: Quote inquiry: from the get-a-quote form
To: inquiry@default.com

Name: John Smith
Phone: None
Email: john_smith@default.com

This is a test from the get a quote form
My wafers are 50\xc5 thick'''

test_msg13 = '''\
From nobody@%s Thu Dec 2 15:48:02 2004
Received: (qmail 17230 invoked from network); 2 Dec 2004 20:48:00 -0000
Received: from localhost (HELO foo.default.com) (127.0.0.1)
\tby 10.27.8.146 with SMTP; 02 Dec 2004 15:48:00 -0500
Content-Type: text/plain; charset="us-ascii"
X-Spam-Status: SPAM 0.999 
Message-ID: <mailman.5670.1139509993.27774.bar@default.com>
From: John Smith <john_smith@default.com>
Subject: Quote inquiry: from the get-a-quote form
To: inquiry@default.com

Name: John Smith
Phone: None
Email: john_smith@default.com

This is a test from the get a quote form
My wafers are 50\xc5 thick'''

test_msg14 = '''\
From nobody@foo.com Thu Dec 2 15:48:02 2004
Received: (qmail 17230 invoked from network); 2 Dec 2004 20:48:00 -0000
Received: from localhost (HELO foo.default.com) (127.0.0.1)
\tby 10.27.8.146 with SMTP; 02 Dec 2004 15:48:00 -0500
Content-Type: text/plain; charset="us-ascii"
X-Spam-Status: SPAM 0.999 
Message-ID: <mailman.5670.1139509993.27774.bar@default.com>
From: John Smith <john_smith@default.com>
Subject:
To: inquiry@default.com

Name: John Smith
Phone: None
Email: john_smith@default.com

This is a test from the get a quote form'''

test_msg15 = '''\
From nobody@foo.com Thu Dec 2 15:48:02 2004
Received: (qmail 17230 invoked from network); 2 Dec 2004 20:48:00 -0000
Received: from localhost (HELO foo.default.com) (127.0.0.1)
\tby 10.27.8.146 with SMTP; 02 Dec 2004 15:48:00 -0500
Content-Type: text/plain; charset="us-ascii"
X-Spam-Status: SPAM 0.999 
Message-ID: <mailman.5670.1139509993.27774.bar@default.com>
From: John Smith <john_smith@default.com>
To: inquiry@default.com

Name: John Smith
Phone: None
Email: john_smith@default.com

This is a test from the get a quote form'''

test_msg16 = """\
From nobody@foo.com Thu Dec 2 15:48:02 2004
Received: (qmail 17230 invoked from network); 2 Dec 2004 20:48:00 -0000
Received: from localhost (HELO foo.default.com) (127.0.0.1)
\tby 10.27.8.146 with SMTP; 02 Dec 2004 15:48:00 -0500
Mime-Version: 1.0 (Apple Message framework v752.2)
References: <0.2096394811.get_a_quote@foo.com>
Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-9--126546472; protocol="application/pkcs7-signature"
Message-Id: <EFDB708F-7BF5-458E-A398-397DFFA53886@foo.com>
Cc: The Boss <boss@foo.com>
From: The Boss <boss@foo.com>
Subject: Fwd: Hot Prospect
Date: Wed, 14 Nov 2007 16:41:41 -0500
To: Mr Worker <worker@foo.com>
X-Mailer: Apple Mail (2.752.2)

--Apple-Mail-9--126546472
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed

Worker,

Can we do this?

-The Boss


Begin forwarded message:

> From: Mr Cool <cool.dude@foo.com>
> Date: November 13, 2007 6:17:38 AM EST
> To: inquiry@foo.com
> Subject: Im a forwarded message
>
> Name: Mr Cool
> Phone: 555-1212
> Email: cool.dude@foo.com
>
> Im a forwarded message.

--Apple-Mail-9--126546472
Content-Transfer-Encoding: base64
Content-Type: application/pkcs7-signature;
name=smime.p7s
Content-Disposition: attachment;
filename=smime.p7s

BOGUSSIGNATUREccAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIKITCCBMww
ggQ1oAMCAQICEByunWua9OYvIoqj2nRhbB4wDQYJKoZIhvcNAQEFBQAwXzELMAkGA1UEBhMCVVMx
FzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAxIFB1YmxpYyBQcmltYXJ=

--Apple-Mail-9--126546472--"""


class InquiryTest(CommonTest):

    def check_re(self):
        assert inquiry_re.match('I123: Subject')
        assert inquiry_re.match('i 23 Subject')
        assert inquiry_re.match('inquiry-23: another subject')
        assert inquiry_re.match('inq 345 - Re: subject subject')
        assert inquiry_re.match('inq-345: good')
        assert inquiry_re.match('Re: inq-345: bad') is None

    def check_inquiry(self):
        if not get_inquiry_db():
            return
        inquiry = Inquiry('my raw msg')
        assert inquiry.get_part_key() == None
        assert inquiry.get_msg() == 'my raw msg'
        inquiry.set_text('my inquiry text')
        assert inquiry.get_text() == 'my inquiry text'
        inquiry.set_title('Test')
        assert inquiry.get_title() == 'Test'
        inquiry.set_from_field('"John Smith" <john_smith@default.com>')
        assert inquiry.get_from_field() == '"John Smith" <john_smith@default.com>'
        user = Contact('John')
        inquiry_user = inquiry.get_user()
        if inquiry_user:
            assert inquiry_user is get_matching_user(
                inquiry.get_from_address())
        inquiry.set_user(user)
        assert inquiry.get_user() is user
        assert inquiry.get_contact() is None
        inquiry.set_contact(user)
        assert inquiry.get_contact() is user
        assert inquiry.get_charset() is ''
        assert Inquiry(test_msg14).get_title() == 'No Subject'
        inquiry15 = Inquiry(test_msg15)
        assert inquiry15.get_title() == 'No Subject'
        inquiry3 = Inquiry(test_msg3)
        assert inquiry3.get_address_fields() == [
            'John Smith <john_smith@default.com>', 'Mike <mike@default.com>']
        raises(ValueError, inquiry3.set_previous_inquiry, inquiry3)
        inquiry3.set_previous_inquiry(inquiry15)
        assert inquiry3.get_previous_inquiry() is inquiry15
        raises(ValueError, inquiry15.set_previous_inquiry, inquiry3)
        inquiry16 = Inquiry(test_msg16)
        assert inquiry16.get_address_fields() == [
            'Mr Cool <cool.dude@foo.com>',
            'Mr Worker <worker@foo.com>',
            'The Boss <boss@foo.com>']

    def check_eq(self):
        if not get_inquiry_db():
            return
        inquiry = Inquiry(test_msg0)
        inquiry2 = Inquiry(test_msg0)
        assert inquiry == inquiry2
        inquiry2 = Inquiry(test_msg1)
        assert inquiry.get_msg() != inquiry2.get_msg()
        assert inquiry == inquiry2
        inquiry2 = Inquiry(test_msg2)
        assert inquiry.get_msg() != inquiry2.get_msg()
        assert not inquiry == inquiry2

    def check_key_searching(self):
        inquiry = Inquiry('John')
        assert inquiry._get_key_from_email_header('any@default.com') == None
        assert inquiry._get_key_from_email_header('R <mail@default.com>') == None
        assert inquiry._get_key_from_email_header('<inquiry@foo.com>') == None
        assert inquiry._get_key_from_email_header('R <inquiry-1@bar.org>') == 1
        assert inquiry._get_key_from_email_header('inquiry-23@foo.biz>') == 23
        assert inquiry._get_key_from_email_header('R <inquiry-A@b.org>') == None

    def check_inquiry_db(self):
        idb = InquiryDatabase()
        domain_name = get_publisher().get_feedback_domain()
        key = idb.add_inquiry_from_string(test_msg1 % domain_name)
        inquiry = idb.get(key)
        assert inquiry.get_part_key() == 'open'
        assert idb.get_part('open').get(inquiry.get_key()) is inquiry
        assert idb.get_part('closed') is None
        idb.move(inquiry, 'closed')
        assert inquiry.get_part_key() == 'closed'
        assert idb.get_part('closed').get(inquiry.get_key()) is inquiry
        assert idb.get_part('open') is None
        assert inquiry.get_from_field() == 'John Smith <john_smith@default.com>'
        assert inquiry.get_from_address() == 'john_smith@default.com'
        assert inquiry.get_charset() == 'us-ascii'
        assert inquiry is idb.get_inquiries()[-1]
        assert inquiry is idb.get_inquiries(sort=1)[-1]
        assert idb.get_inquiry_with_message_id(
            '<mailman.5670.1139509993.27774.bar@default.com>') is inquiry
        assert idb.get_inquiry_with_message_id('no-such-message-id') is None

    def check_insertion(self):
        if get_inquiry_db() is None:
            return
        idb = get_inquiry_db()
        domain_name = get_publisher().get_feedback_domain()
        assert domain_name
        key = idb.add_inquiry_from_string(test_msg1 % domain_name)
        assert idb.get(key).has_interactions() is False
        key2 = idb.add_inquiry_from_string(test_msg0 % domain_name)
        assert key2 == -1, key2
        key2 = idb.add_inquiry_from_string(test_msg2 % (domain_name, key))
        assert key2 == key, "%d != %d" % (key2, key)
        assert idb.get(key).has_interactions() is True
        key2 = idb.add_inquiry_from_string(test_msg3 % (domain_name, key))
        assert key2 == key, "%d != %d" % (key2, key)
        key2 = idb.add_inquiry_from_string(test_msg4 % domain_name)
        assert key2 == key, "%d != %d" % (key2, key)
        key2 = idb.add_inquiry_from_string(test_msg5 % domain_name)
        assert key2 != key, "%d == %d" % (key2, key)
        assert idb.get(key2).get_text() == 'Badly formed multipart message'
        key2 = idb.add_inquiry_from_string(test_msg6 % domain_name)
        assert idb.get(key2).get_text().startswith('Bad Content type')
        key2 = idb.add_inquiry_from_string(test_msg7 % domain_name)
        assert idb.get(key2).get_text() == ('Multipart message with no '
                                            '"text/plain" or "text/html" parts')
        key2 = idb.add_inquiry_from_string(test_msg8 % domain_name)
        assert key2 == key, "%d != %d" % (key2, key)
        key2 = idb.add_inquiry_from_string(test_msg9 % domain_name)
        assert key2 == key, "%d != %d" % (key2, key)
        key2 = idb.add_inquiry_from_string(test_msg10)
        assert key2 == -1, key2
        key2 = idb.add_inquiry_from_string(test_msg11 % (domain_name, key))
        assert key2 == key, "%d != %d" % (key2, key)
        assert idb.add_inquiry_from_string(test_msg12 % domain_name) == -1
        assert idb.add_inquiry_from_string(test_msg13 % domain_name) == -1

if __name__ == "__main__":
    InquiryTest()
