Feature 10914: Enforce Password change on First login
[osm/NBI.git] / osm_nbi / tests / test_admin_topics.py
index 734a289..8124ce4 100755 (executable)
@@ -999,6 +999,22 @@ class Test_UserTopicAuth(TestCase):
                 norm(str(e.exception)),
                 "Wrong exception text",
             )
+        with self.subTest(i=3):
+            self.auth.get_user_list.side_effect = [[user], []]
+            self.auth.get_user.return_value = user
+            old_password = self.test_name
+            new_pasw = "new-password"
+            self.topic.edit(
+                self.fake_session,
+                uid,
+                {
+                    "old_password": old_password,
+                    "password": new_pasw,
+                },
+            )
+            content = self.auth.update_user.call_args[0][0]
+            self.assertEqual(content["old_password"], old_password, "Wrong old password")
+            self.assertEqual(content["password"], new_pasw, "Wrong user password")
 
     def test_delete_user(self):
         with self.subTest(i=1):