<s> '''<STR_LIT>''' <EOL> import unittest <EOL> from datetime import datetime <EOL> from app . wiki import WikiParser , url_patterns , mongo_host , mongo_port , db_name <EOL> class FakeWikiParser ( WikiParser ) : <EOL> def store ( self , title , content , last_update ) : <EOL> self . title , self . content , self . last_update = title , content , last_update <EOL> class Test ( unittest . TestCase ) : <EOL> def testWikiParser ( self ) : <EOL> parser = FakeWikiParser ( ) <EOL> print dir ( parser ) <EOL> for url in ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) : <EOL> parser . parse ( url ) <EOL> lang = url . strip ( '<STR_LIT>' ) . split ( '<STR_LIT:.>' , <NUM_LIT:1> ) [ <NUM_LIT:0> ] <EOL> self . assertEqual ( parser . title , '<STR_LIT>' + lang ) <EOL> self . assertGreater ( len ( parser . content ) , <NUM_LIT:0> ) <EOL> self . assertTrue ( isinstance ( parser . last_update , datetime ) ) <EOL> self . assertIsNotNone ( url_patterns . get_parser ( url ) ) <EOL> parser = WikiParser ( ) <EOL> url = '<STR_LIT>' <EOL> parser . parse ( url ) <EOL> from pymongo import Connection <EOL> conn = Connection ( mongo_host , mongo_port ) <EOL> db = getattr ( conn , db_name ) <EOL> wiki = db . wiki_document . find_one ( { '<STR_LIT:title>' : '<STR_LIT>' } ) <EOL> self . assertIsNotNone ( wiki ) <EOL> db . wiki_document . remove ( { '<STR_LIT:title>' : '<STR_LIT>' } ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
