diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_configparser.py | 30 | ||||
-rw-r--r-- | tests/test_filemanager.py | 28 |
2 files changed, 44 insertions, 14 deletions
diff --git a/tests/test_configparser.py b/tests/test_configparser.py new file mode 100644 index 000000000..29ba9e51b --- /dev/null +++ b/tests/test_configparser.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- + +from collections import defaultdict +from helper.Stubs import Core + +from module.database import DatabaseBackend +from module.config.ConfigParser import ConfigParser + +# TODO +class TestConfigParser(): + + @classmethod + def setUpClass(cls): + cls.db = DatabaseBackend(Core()) + cls.db.manager = cls.db.core + cls.db.manager.statusMsg = defaultdict(lambda: "statusmsg") + cls.config = ConfigParser + + + def test_db(self): + pass + + def test_dict(self): + pass + + def test_config(self): + pass + + def test_userconfig(self): + pass
\ No newline at end of file diff --git a/tests/test_filemanager.py b/tests/test_filemanager.py index a9c6d3375..f5bdd9df3 100644 --- a/tests/test_filemanager.py +++ b/tests/test_filemanager.py @@ -82,11 +82,11 @@ class TestFileManager(BenchmarkTest): p.delete() - self.m.getView(-1, True, False) + self.m.getTree(-1, True, False) def test_get_files_root(self): - view = self.m.getView(-1, True, False) + view = self.m.getTree(-1, True, False) for pid in self.pids: assert pid in view.packages @@ -99,14 +99,14 @@ class TestFileManager(BenchmarkTest): def test_get_package_content(self): - view = self.m.getView(choice(self.pids), False, False) + view = self.m.getTree(choice(self.pids), False, False) p = view.root assert len(view.packages) == len(p.pids) for pid in p.pids: assert pid in view.packages def test_get_package_tree(self): - view = self.m.getView(choice(self.pids), True, False) + view = self.m.getTree(choice(self.pids), True, False) for pid in view.root.pids: assert pid in view.packages for fid in view.root.fids: assert fid in view.files @@ -119,7 +119,7 @@ class TestFileManager(BenchmarkTest): self.m.addLinks([("url", "plugin") for i in range(100)], parent) pids = [self.m.addPackage("c", "", parent, "", "", "", False) for i in range(5)] - v = self.m.getView(parent, False, False) + v = self.m.getTree(parent, False, False) self.assert_ordered(pids, 0, 5, v.root.pids, v.packages, True) pid = v.packages.keys()[0] @@ -136,7 +136,7 @@ class TestFileManager(BenchmarkTest): def test_order_files(self): parent = self.m.addPackage("order", "", -1, "", "", "", False) self.m.addLinks([("url", "plugin") for i in range(100)], parent) - v = self.m.getView(parent, False, False) + v = self.m.getTree(parent, False, False) fids = v.root.fids[10:20] v = self.assert_files_ordered(parent, fids, 0) @@ -144,7 +144,7 @@ class TestFileManager(BenchmarkTest): fids = v.root.fids[20:30] self.m.orderFiles(fids, parent, 99) - v = self.m.getView(parent, False, False) + v = self.m.getTree(parent, False, False) assert fids[-1] == v.root.fids[-1] assert fids[0] == v.root.fids[90] self.assert_ordered(fids, 90, 100, v.root.fids, v.files) @@ -153,12 +153,12 @@ class TestFileManager(BenchmarkTest): v = self.assert_files_ordered(parent, fids, 20) self.m.orderFiles(fids, parent, 80) - v = self.m.getView(parent, False, False) + v = self.m.getTree(parent, False, False) self.assert_ordered(fids, 61, 81, v.root.fids, v.files) fids = v.root.fids[50:51] self.m.orderFiles(fids, parent, 99) - v = self.m.getView(parent, False, False) + v = self.m.getTree(parent, False, False) self.assert_ordered(fids, 99, 100, v.root.fids, v.files) fids = v.root.fids[50:51] @@ -168,14 +168,14 @@ class TestFileManager(BenchmarkTest): def assert_files_ordered(self, parent, fids, pos): fs = [self.m.getFile(choice(fids)) for i in range(5)] self.m.orderFiles(fids, parent, pos) - v = self.m.getView(parent, False, False) + v = self.m.getTree(parent, False, False) self.assert_ordered(fids, pos, pos+len(fids), v.root.fids, v.files) return v def assert_pack_ordered(self, parent, pid, pos): self.m.orderPackage(pid, pos) - v = self.m.getView(parent, False, False) + v = self.m.getTree(parent, False, False) self.assert_ordered([pid], pos, pos+1, v.root.pids, v.packages, True) # assert that ordering is total, complete with no gaps @@ -195,15 +195,15 @@ class TestFileManager(BenchmarkTest): pid2 = self.pids[1] self.m.movePackage(pid, -1) - v = self.m.getView(-1, False, False) + v = self.m.getTree(-1, False, False) assert v.root.pids[-1] == pid assert sorted([p.packageorder for p in v.packages.values()]) == range(len(v.packages)) - v = self.m.getView(pid, False, False) + v = self.m.getTree(pid, False, False) fids = v.root.fids[10:20] self.m.moveFiles(fids, pid2) - v = self.m.getView(pid2, False, False) + v = self.m.getTree(pid2, False, False) assert sorted([f.fileorder for f in v.files.values()]) == range(len(v.files)) assert len(v.files) == self.count + len(fids) |