1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-09-13 13:51:53 +00:00

Add update emailuser id RPC (#349)

* Add update emailuser id RPC

* Add test shareing and group relationship when update user id
This commit is contained in:
feiniks
2020-05-15 14:21:27 +08:00
committed by GitHub
parent 33536cc56c
commit 72de8b5997
10 changed files with 178 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ from seaserv import ccnet_api
from tests.utils import randstring
from tests.config import USER, USER2, ADMIN_USER
def test_user_management():
def test_user_management(repo):
email1 = '%s@%s.com' % (randstring(6), randstring(6))
email2 = '%s@%s.com' % (randstring(6), randstring(6))
passwd1 = 'randstring(6)'
@@ -36,5 +36,32 @@ def test_user_management():
assert email2_new.is_active == True
assert email2_new.is_staff == True
ccnet_api.remove_emailuser('DB', email1)
#test group when update user id
id1 = ccnet_api.create_group('group1', email1, parent_group_id=-1)
assert id1 != -1
group1 = ccnet_api.get_group(id1)
assert group1.parent_group_id == -1
# test shared repo when update user id
api.share_repo(repo.id, USER, email1, "rw")
assert api.repo_has_been_shared(repo.id)
new_email1 = '%s@%s.com' % (randstring(6), randstring(6))
assert ccnet_api.update_emailuser_id (email1, new_email1) == 0
shared_users = api.list_repo_shared_to(USER, repo.id)
assert len (shared_users) == 1
assert shared_users[0].repo_id == repo.id
assert shared_users[0].user == new_email1
assert shared_users[0].perm == "rw"
api.remove_share(repo.id, USER, new_email1)
email1_groups = ccnet_api.get_groups (new_email1)
assert len (email1_groups) == 1
assert email1_groups[0].id == id1
rm1 = ccnet_api.remove_group(id1)
assert rm1 == 0
ccnet_api.remove_emailuser('DB', new_email1)
ccnet_api.remove_emailuser('DB', email2)