@@ -42,39 +42,26 @@ def teardown_method(self):
4242 self .pwd_change .cleanup ()
4343
4444 @pytest .mark .parametrize (
45- "username, password, pwd_change" ,
45+ "username, password, pwd_change, user_change, test_dir " ,
4646 [
47- ("user" , "foo" , False ),
48- ("user" , "bar" , True ),
47+ ("user" , "foo" , False , False , pwd_dir_change ),
48+ ("user" , "bar" , True , False , pwd_dir_change ),
49+ ("user" , "foo" , False , False , user_dir_change ),
50+ ("user2" , "bar" , False , True , user_dir_change ),
4951 ],
5052 )
51- def test_password_change (self , username , password , pwd_change ):
53+ def test_password_and_user_change (
54+ self , username , password , pwd_change , user_change , test_dir
55+ ):
5256 """
5357 Test password change.
5458 """
5559
5660 self .password_change_test (
5761 username = username ,
5862 password = password ,
59- pwd_dir = pwd_dir_change ,
63+ pwd_dir = test_dir ,
6064 pwd_change = pwd_change ,
61- )
62-
63- @pytest .mark .parametrize (
64- "username, password, user_change" ,
65- [
66- ("user" , "foo" , False ),
67- ("user2" , "bar" , True ),
68- ],
69- )
70- def test_password_change_new_user_test (self , username , password , user_change ):
71- """
72- Test user change.
73- """
74- self .password_change_test (
75- username = username ,
76- password = password ,
77- pwd_dir = user_dir_change ,
7865 user_change = user_change ,
7966 )
8067
@@ -92,9 +79,11 @@ def password_change_test(
9279 1. Create a container with the given arguments
9380 2. Check if the container is created successfully
9481 3. Check if the database connection works
95- 4. Check if the userchange, then user2 does exist in the database
96- 5. Check if the password works
97- 6. Check if the password does not work
82+ 4. If user_change is True, then 'user' and 'foo' are used for testing connection
83+ 4. Check if the userchange, then user2 does exist in the database logs
84+ 5. Check if the userchange, then sql command should work with the 'user' and 'bar' should
85+ not work and should return an error message
86+ 6. If pwd_change is True, then 'user' and 'pwdfoo' should not work and should return an error message
9887 """
9988 cid_file_name = f"test_{ username } _{ password } _{ user_change } "
10089
0 commit comments