new: [test] Security test for forget password

pull/9690/head
Jakub Onderka 2024-04-20 13:47:43 +02:00
parent b5100dcedd
commit 97e6224755
1 changed files with 10 additions and 0 deletions

View File

@ -789,6 +789,16 @@ class TestSecurity(unittest.TestCase):
# Password should be still the same
self.assertIsInstance(login(url, self.test_usr.email, self.test_usr_password), requests.Session)
def test_forget_password_not_enabled(self):
logged_in = PyMISP(url, self.test_usr.authkey)
logged_in.global_pythonify = True
with self.assertRaises(Exception):
send(logged_in, "GET", f"/users/forget")
with self.assertRaises(Exception):
send(logged_in, "GET", f"/users/password_reset/abcd")
def test_add_user_by_org_admin(self):
user = MISPUser()
user.email = 'testusr@user' + random() + '.local' # make name always unique