summaryrefslogtreecommitdiffstats
path: root/tests/manager/test_accountManager.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manager/test_accountManager.py')
-rw-r--r--tests/manager/test_accountManager.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/tests/manager/test_accountManager.py b/tests/manager/test_accountManager.py
index b7166b2bd..dccba9d7c 100644
--- a/tests/manager/test_accountManager.py
+++ b/tests/manager/test_accountManager.py
@@ -4,6 +4,8 @@ from unittest import TestCase
from tests.helper.Stubs import Core, adminUser, normalUser
+from pyload.AccountManager import AccountManager
+
class TestAccountManager(TestCase):
@classmethod
@@ -17,19 +19,20 @@ class TestAccountManager(TestCase):
def setUp(self):
self.db.purgeAccounts()
- self.manager = self.core.accountManager
+ self.manager = AccountManager(self.core)
def test_access(self):
- account = self.manager.updateAccount("Http", "User", "somepw", adminUser)
+ account = self.manager.createAccount("Http", "User", "somepw", adminUser.uid)
- assert account is self.manager.updateAccount("Http", "User", "newpw", adminUser)
+ assert account is self.manager.updateAccount(account.aid, "Http", "User", "newpw", adminUser)
self.assertEqual(account.password, "newpw")
- assert self.manager.getAccount("Http", "User") is account
- assert self.manager.getAccount("Http", "User", normalUser) is None
+ assert self.manager.getAccount(account.aid, "Http", adminUser) is account
+ assert self.manager.getAccount(account.aid, "Http", normalUser) is None
+
def test_config(self):
- account = self.manager.updateAccount("Http", "User", "somepw", adminUser)
+ account = self.manager.createAccount("Http", "User", "somepw", adminUser.uid)
info = account.toInfoData()
self.assertEqual(info.config[0].name, "domain")
@@ -48,7 +51,7 @@ class TestAccountManager(TestCase):
def test_shared(self):
- account = self.manager.updateAccount("Http", "User", "somepw", adminUser)
+ account = self.manager.createAccount("Http", "User", "somepw", adminUser.uid)
assert self.manager.selectAccount("Http", adminUser) is account
assert account.loginname == "User"
@@ -61,5 +64,10 @@ class TestAccountManager(TestCase):
assert self.manager.selectAccount("Http", normalUser) is account
assert self.manager.selectAccount("sdf", normalUser) is None
+ self.manager.removeAccount(account.aid, "Http", adminUser.uid)
+
+ assert self.manager.selectAccount("Http", adminUser) is None
+
+