|
|
|
@ -18,7 +18,7 @@
|
|
|
|
|
import shutil
|
|
|
|
|
import time
|
|
|
|
|
import unittest
|
|
|
|
|
from dumpgenerator import delay, getImageFilenamesURLAPI
|
|
|
|
|
from dumpgenerator import delay, getImageFilenamesURL, getImageFilenamesURLAPI
|
|
|
|
|
|
|
|
|
|
class TestDumpgenerator(unittest.TestCase):
|
|
|
|
|
#Documentation
|
|
|
|
@ -40,6 +40,21 @@ class TestDumpgenerator(unittest.TestCase):
|
|
|
|
|
t2 = time.time() - t1
|
|
|
|
|
self.assertTrue(t2 > 3 and t2 < 3.001)
|
|
|
|
|
|
|
|
|
|
def test_getImageFilenamesURL(self):
|
|
|
|
|
#Checks if this filename かずさアノテーション_-_ソーシャル・ゲノム・アノテーション.jpg is well parsed from API
|
|
|
|
|
#http://wiki.annotation.jp/images/0/02/%E3%81%8B%E3%81%9A%E3%81%95%E3%82%A2%E3%83%8E%E3%83%86%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3_-_%E3%82%BD%E3%83%BC%E3%82%B7%E3%83%A3%E3%83%AB%E3%83%BB%E3%82%B2%E3%83%8E%E3%83%A0%E3%83%BB%E3%82%A2%E3%83%8E%E3%83%86%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3.jpg
|
|
|
|
|
config = {
|
|
|
|
|
'index': 'http://wiki.annotation.jp/index.php',
|
|
|
|
|
'delay': 0,
|
|
|
|
|
}
|
|
|
|
|
japaneseFilename = u'かずさアノテーション - ソーシャル・ゲノム・アノテーション.jpg'
|
|
|
|
|
print 'Checking', config['index']
|
|
|
|
|
print 'Trying to parse', japaneseFilename, 'without API'
|
|
|
|
|
result = getImageFilenamesURL(config=config)
|
|
|
|
|
|
|
|
|
|
self.assertTrue(len(result) > 250)
|
|
|
|
|
self.assertTrue(japaneseFilename in [filename for filename, url, uploader in result])
|
|
|
|
|
|
|
|
|
|
def test_getImageFilenamesURLAPI(self):
|
|
|
|
|
#Checks if this filename かずさアノテーション_-_ソーシャル・ゲノム・アノテーション.jpg is well parsed from API
|
|
|
|
|
#http://wiki.annotation.jp/images/0/02/%E3%81%8B%E3%81%9A%E3%81%95%E3%82%A2%E3%83%8E%E3%83%86%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3_-_%E3%82%BD%E3%83%BC%E3%82%B7%E3%83%A3%E3%83%AB%E3%83%BB%E3%82%B2%E3%83%8E%E3%83%A0%E3%83%BB%E3%82%A2%E3%83%8E%E3%83%86%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3.jpg
|
|
|
|
|