Package prototype :: Module unit_tests :: Class ParserTestCase
[hide private]
[frames] | no frames]

Class ParserTestCase

source code


Nested Classes [hide private]

Inherited from unittest.TestCase: failureException

Instance Methods [hide private]
 
setUp(self)
Hook method for setting up the test fixture before exercising it.
source code
 
tearDown(self)
Hook method for deconstructing the test fixture after testing it.
source code
 
testEmailParser(self)
Iterates through text files in './test_data'.
source code

Inherited from unittest.TestCase: __call__, __init__, __repr__, __str__, assertAlmostEqual, assertAlmostEquals, assertEqual, assertEquals, assertFalse, assertNotAlmostEqual, assertNotAlmostEquals, assertNotEqual, assertNotEquals, assertRaises, assertTrue, assert_, countTestCases, debug, defaultTestResult, fail, failIf, failIfAlmostEqual, failIfEqual, failUnless, failUnlessAlmostEqual, failUnlessEqual, failUnlessRaises, id, run, shortDescription

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

setUp(self)

source code 

Hook method for setting up the test fixture before exercising it.

Overrides: unittest.TestCase.setUp
(inherited documentation)

tearDown(self)

source code 

Hook method for deconstructing the test fixture after testing it.

Overrides: unittest.TestCase.tearDown
(inherited documentation)

testEmailParser(self)

source code 

Iterates through text files in './test_data'. Each of the text
files should contain the valid JSON structure of the following
information:

{
    'expected_asker':
    {
        'query':
        {
            'product_id':<product id, eg '18675309'>
        },
        'sender': <sender's name, eg 'lucy'>,
        'domain': <sender's domain, eg 'bilumi.org'>,
        'recipient': <recipient's name, eg 'score'>,
        'recipient_domain': <recipient's domain, eg 'bilumi.org'>
    },
    'email': [<list of strings that represent complete email, including headers>]
}

The email is sent to Asker.parse_email, which returns the actual Asker.