mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-24 16:57:30 +00:00
feat: improve user/group management actions (#9602)
* feat: improve user management actions add "open profile" actions * add lock / unlock action * add actions for password reset * submit coverage info to codecov no idea why this was turned off * bump api version * add frontend test * add backend test * fix test state * move test * fix style * fix name * hide password change if not superuser * bump playwright see https://github.com/microsoft/playwright/issues/35183 * fix test * fix test order * simplify test --------- Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
1 parent
8346318f7d
commit
d5fa609275
13 files changed
+242
-24
No files matched your search
@@ -209,6 +209,32 @@ class UserAPITests(InvenTreeAPITestCase):
|
||||
self.assertEqual(len(data['permissions']), len(perms) + len(build_perms))
|
||||
|
||||
|
||||
class SuperuserAPITests(InvenTreeAPITestCase):
|
||||
"""Tests for user API endpoints that require superuser rights."""
|
||||
|
||||
fixtures = ['users']
|
||||
superuser = True
|
||||
|
||||
def test_user_password_set(self):
|
||||
"""Test the set-password/ endpoint."""
|
||||
user = User.objects.get(pk=2)
|
||||
url = reverse('api-user-set-password', kwargs={'pk': user.pk})
|
||||
|
||||
# to simple password
|
||||
resp = self.put(url, {'password': 1}, expected_code=400)
|
||||
self.assertContains(resp, 'This password is too short', status_code=400)
|
||||
|
||||
# now with overwerite
|
||||
resp = self.put(
|
||||
url, {'password': 1, 'override_warning': True}, expected_code=200
|
||||
)
|
||||
self.assertEqual(resp.data, {})
|
||||
|
||||
# complex enough pwd
|
||||
resp = self.put(url, {'password': 'inventree'}, expected_code=200)
|
||||
self.assertEqual(resp.data, {})
|
||||
|
||||
|
||||
class UserTokenTests(InvenTreeAPITestCase):
|
||||
"""Tests for user token functionality."""
|
||||
|
||||
|
||||
Reference in new issue
Block a user