1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-15 23:00:57 +00:00

Improve login and create user (#5458)

* add create oauth/ldap/saml user in UserManager

* improve admin add/import users

* improve dingtalk/weixin/work_weixin login/create user

* improve saml login/create user

* improve oauth login/create user

* login ldap user in seahub

* improve invite user

* fix code

* fix github test action

* fix test

* fix saml login

* optimize code

* specify the version of python-ldap

* fix code

* improve code

* add get_old_user

* optimize oauth login code

* optimize code

* remove LDAP_USER_UNIQUE_ID

* remove test_primary_id

* improve authenticate user

* improve saml login

* optimize code
This commit is contained in:
WJH
2023-06-19 13:06:15 +08:00
committed by GitHub
parent 42773a692d
commit 532fa5ef8c
45 changed files with 689 additions and 591 deletions

View File

@@ -1,37 +1,14 @@
import requests
import unittest
from tests.common.utils import apiurl, urljoin, randstring
from tests.common.utils import randstring
from tests.api.apitestbase import ApiTestBase
from tests.api.urls import ACCOUNTS_URL, PING_URL, \
AUTH_PING_URL
from tests.api.urls import PING_URL, AUTH_PING_URL
test_account_username = 'test_%s@test.com' % randstring(10)
test_account_password = randstring(20)
test_account_password2 = randstring(20)
test_account_url = urljoin(ACCOUNTS_URL, test_account_username)
class AccountsApiTest(ApiTestBase):
def test_list_accounts(self):
# Normal user can not list accounts
self.get(ACCOUNTS_URL, expected=403)
accounts = self.admin_get(ACCOUNTS_URL).json()
self.assertGreaterEqual(len(accounts), 2)
# TODO: check returned json, test start/limit param
def test_create_delete_account(self):
data = {'password': test_account_password}
# non-admin user can not create new user
self.put(test_account_url, data=data, expected=403)
self.admin_put(test_account_url, data=data, expected=201)
# non-admin user can not delete a user
self.delete(test_account_url, expected=403)
self.admin_delete(test_account_url)
# check the user is really deleted
self.admin_get(test_account_url, expected=404)
def test_update_account_passwd(self):
with self.get_tmp_user() as user: