summaryrefslogtreecommitdiffstats
path: root/tests/manager/test_downloadManager.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manager/test_downloadManager.py')
-rw-r--r--tests/manager/test_downloadManager.py28
1 files changed, 21 insertions, 7 deletions
diff --git a/tests/manager/test_downloadManager.py b/tests/manager/test_downloadManager.py
index 9906ca1a0..305451d7f 100644
--- a/tests/manager/test_downloadManager.py
+++ b/tests/manager/test_downloadManager.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-from tests.helper.Stubs import Core, normalUser, adminUser
+from tests.helper.Stubs import Core, normalUser, adminUser, otherUser
from tests.helper.BenchmarkTest import BenchmarkTest
from pyload.database import DatabaseBackend
@@ -9,13 +9,21 @@ DatabaseBackend.async = DatabaseBackend.queue
class TestDownloadManager(BenchmarkTest):
- bench = ["add_links", "db"]
+ bench = ["add_links", "simple", "empty"]
+
+ USER = 2
+ PACKAGES = 10
+ LINKS = 50
+ PLUGINS = 10
@classmethod
def setUpClass(cls):
cls.c = Core()
cls.db = cls.c.db
cls.db.purgeAll()
+ cls.db.addDebugUser(normalUser.uid)
+ cls.db.addDebugUser(adminUser.uid)
+ cls.db.addDebugUser(otherUser.uid)
cls.files = cls.c.files
cls.m = cls.c.downloadManager
@@ -30,12 +38,18 @@ class TestDownloadManager(BenchmarkTest):
def test_add_links(self):
# just generate some links and files
- for i in range(10):
- pid = self.files.addPackage("name %d", "folder", -1, "", "", "", False, normalUser.uid)
- self.files.addLinks([("plugin%d" % i, "url%d" %i) for i in range(50)], pid, normalUser.uid)
+ for user in (adminUser, normalUser):
+ for i in range(self.PACKAGES):
+ pid = self.files.addPackage("name %d", "folder", -1, "", "", "", False, user.uid)
+ self.files.addLinks([( "url%d" %i, "plugin%d" % (i % self.PLUGINS)) for i in range(self.LINKS)], pid, user.uid)
+
+ def test_simple(self):
+ jobs = self.db.getJobs([])
+ assert len(jobs) == 2
+
+ def test_empty(self):
+ assert not self.db.getJobs(["plugin%d" % i for i in range(self.PLUGINS)])
- def test_db(self):
- pass
if __name__ == "__main__":