summaryrefslogtreecommitdiffstats
path: root/tests/APIExerciser.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-04-18 00:29:55 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-04-18 00:29:55 +0200
commitbb5a115533711fd8bb87f53cb32ff7342137208d (patch)
tree476600f9896fae029880e4049eb4c5e6021b202d /tests/APIExerciser.py
parentPEP-8, Python Zen, refactor and reduce code (part 6 in master module/common) (diff)
downloadpyload-bb5a115533711fd8bb87f53cb32ff7342137208d.tar.xz
Spare code cosmetics (5)
Diffstat (limited to 'tests/APIExerciser.py')
-rw-r--r--tests/APIExerciser.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/APIExerciser.py b/tests/APIExerciser.py
index 32a3304c0..d17f81ae2 100644
--- a/tests/APIExerciser.py
+++ b/tests/APIExerciser.py
@@ -32,11 +32,12 @@ sumCalled = 0
def startApiExerciser(core, n):
- for _ in range(n):
+ for _i in range(n):
APIExerciser(core).start()
class APIExerciser(Thread):
+
def __init__(self, core, thrift=False, user=None, pw=None):
global idPool
@@ -114,9 +115,11 @@ class APIExerciser(Thread):
self.api.addPackage(name, urls, choice([Destination.Queue, Destination.Collector]))
+
def deleteFiles(self):
info = self.api.getQueueData()
- if not info: return
+ if not info:
+ return
pack = choice(info)
fids = pack.links
@@ -125,9 +128,11 @@ class APIExerciser(Thread):
fids = [f.fid for f in sample(fids, randint(1, max(len(fids) / 2, 1)))]
self.api.deleteFiles(fids)
+
def deletePackages(self):
info = choice([self.api.getQueue(), self.api.getCollector()])
- if not info: return
+ if not info:
+ return
pids = [p.pid for p in info]
if pids: