forked from fake-name/AutoTriever
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
74 lines (51 loc) · 1.36 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import dispatcher
import sys
import deps.logSetup
import logging
def get_plugin_lut():
log = logging.getLogger("Main.Importer")
deps.logSetup.initLogging()
log.info("Testing import options")
initCalls = dispatcher.loadPlugins('init', 'InitSystem_')
for initCall in initCalls:
p = initCalls[initCall]()
print(p.calls['init']())
print('InitCall: ', initCall)
plugins = dispatcher.loadPlugins('modules', "PluginInterface_")
return plugins
def test_storiesonline():
import main
settings = main.loadSettings()
dispatch_cls = dispatcher.RpcCallDispatcher(settings)
for x in range(12880, 12980):
url = "http://storiesonline.net/s/{num}/".format(num=x)
args = (url, )
kwargs = {}
try:
ret = dispatch_cls.doCall("StoriesOnlineFetch", "getpage", call_args=args, call_kwargs=kwargs)
print(ret)
except Exception:
pass
CALL_LUT = {
"stories-online" : test_storiesonline,
}
def test():
deps.logSetup.initLogging()
if len(sys.argv) < 2:
plugin_lut = get_plugin_lut()
print("ERROR:")
print("You must specify a plugin to test!")
print("Known commands:")
for command in CALL_LUT.keys():
print(" ", command)
return
target = sys.argv[1]
if target in CALL_LUT:
CALL_LUT[target]()
else:
print("Unknown arg!")
print("Known commands:")
for command in CALL_LUT.keys():
print(" ", command)
if __name__ == "__main__":
test()