@ -162,20 +162,34 @@ class TestDumpgenerator(unittest.TestCase):
# Testing with API
print ' \n Testing ' , api
print ' Trying to parse ' , pagetocheck , ' with API '
config_api = { ' api ' : api , ' index ' : ' ' , ' delay ' : 0 , ' namespaces ' : [ ' all ' ] , ' exnamespaces ' : [ ] , ' date ' : datetime . datetime . now ( ) . strftime ( ' % Y % m %d ' ) , ' path ' : ' . ' }
getPageTitles ( config = config_api , session = session )
titles_api = ' ./ %s - %s -titles.txt ' % ( domain2prefix ( config = config_api ) , config_api [ ' date ' ] )
result_api = open ( titles_api , ' r ' ) . read ( ) . splitlines ( )
config_api = { ' api ' : api ,
' index ' : ' ' ,
' delay ' : 0 ,
' namespaces ' : [ ' all ' ] , ' exnamespaces ' : [ ] ,
' date ' : datetime . datetime . now ( ) . strftime ( ' % Y % m %d ' ) ,
' path ' : ' . ' ,
' retries ' : 5 ,
}
titles_api = getPageTitles ( config = config_api , session = session )
result_api = open ( titles_api , ' r ' ) . read ( ) . decode ( ' utf8 ' ) . splitlines ( )
os . remove ( titles_api )
self . assertTrue ( pagetocheck in result_api )
# Testing with index
print ' Testing ' , index
print ' Trying to parse ' , pagetocheck , ' with index '
config_index = { ' index ' : index , ' api ' : ' ' , ' delay ' : 0 , ' namespaces ' : [ ' all ' ] , ' exnamespaces ' : [ ] , ' date ' : datetime . datetime . now ( ) . strftime ( ' % Y % m %d ' ) , ' path ' : ' . ' }
getPageTitles ( config = config_index , session = session )
titles_index = ' ./ %s - %s -titles.txt ' % ( domain2prefix ( config = config_index ) , config_index [ ' date ' ] )
result_index = open ( titles_index , ' r ' ) . read ( ) . splitlines ( )
config_index = { ' index ' : index ,
' api ' : ' ' ,
' delay ' : 0 ,
' namespaces ' : [ ' all ' ] ,
' exnamespaces ' : [ ] ,
' date ' : datetime . datetime . now ( ) . strftime ( ' % Y % m %d ' ) ,
' path ' : ' . ' ,
' retries ' : 5 }
titles_index = getPageTitles ( config = config_index , session = session )
result_index = open ( titles_index , ' r ' ) . read ( ) . decode ( ' utf8 ' ) . splitlines ( )
os . remove ( titles_index )
self . assertTrue ( pagetocheck in result_index )
self . assertEqual ( len ( result_api ) , len ( result_index ) )
@ -183,7 +197,8 @@ class TestDumpgenerator(unittest.TestCase):
# Compare every page in both lists, with/without API
c = 0
for pagename_api in result_api :
self . assertEqual ( pagename_api . decode ( ' utf8 ' ) , result_index [ c ] . decode ( ' utf8 ' ) , u ' {0} and {1} are different ' . format ( pagename_api . decode ( ' utf8 ' ) , result_index [ c ] . decode ( ' utf8 ' ) ) )
chk = pagename_api in result_index
self . assertEqual ( chk , True , u ' %s not in result_index ' % ( pagename_api ) )
c + = 1
def test_getWikiEngine ( self ) :
@ -212,11 +227,11 @@ class TestDumpgenerator(unittest.TestCase):
[ ' https://confluence.atlassian.com/ ' , ' Confluence ' ] ,
#['https://wiki.hybris.com/dashboard.action', 'Confluence'],
[ ' https://confluence.sakaiproject.org/ ' , ' Confluence ' ] ,
[ ' http://demo.bananadance.org/ ' , ' Banana Dance ' ] ,
#['http://demo.bananadance.org/', 'Banana Dance'] ,
[ ' http://wagn.org/ ' , ' Wagn ' ] ,
[ ' http://wiki.ace-mod.net/ ' , ' Wagn ' ] ,
[ ' https://success.mindtouch.com/ ' , ' MindTouch ' ] ,
[ ' https://jspwiki.apache.org/ ' , ' JSPWiki ' ] ,
#['https://success.mindtouch.com/', 'MindTouch'] ,
#['https://jspwiki.apache.org/', 'JSPWiki'] ,
[ ' http://www.ihear.com/FreeCLAS/ ' , ' JSPWiki ' ] ,
[ ' http://www.wikkawiki.org/HomePage ' , ' WikkaWiki ' ] ,
[ ' http://puppylinux.org/wikka/ ' , ' WikkaWiki ' ] ,