4444TEST_DISPLAY_NAME = "test_name"
4545464647- TEST_PASS = "pass "
47+ TEST_PASS = "test_pass "
4848TEST_PASSWORD = "test_password"
4949TEST_ROLE = "user"
5050TEST_USER = "test_user"
@@ -131,7 +131,7 @@ def test_create_user_empty_username(self):
131131 """
132132 Try to create a user with an empty username field.
133133 """
134- data = dict (username = "" , display_name = TEST_DISPLAY_NAME , password = "test_pass" , email = TEST_EMAIL , role = TEST_ROLE ,
134+ data = dict (username = "" , display_name = TEST_DISPLAY_NAME , password = TEST_PASS , email = TEST_EMAIL , role = TEST_ROLE ,
135135 comment = "" )
136136 with pytest .raises (UsernameException ):
137137 self .user_service .create_user (** data )
@@ -140,7 +140,7 @@ def test_create_user_no_username(self):
140140 """
141141 Try to create a user with no username data.
142142 """
143- data = dict (password = "test_pass" , display_name = TEST_DISPLAY_NAME , email = TEST_EMAIL , role = TEST_ROLE , comment = "" )
143+ data = dict (password = TEST_PASS , display_name = TEST_DISPLAY_NAME , email = TEST_EMAIL , role = TEST_ROLE , comment = "" )
144144 with pytest .raises (UsernameException ):
145145 self .user_service .create_user (** data )
146146
@@ -217,7 +217,7 @@ def test_is_username_valid(self):
217217 Test the method that checks if a userName is valid or not (if it already exists
218218 in the database the userName is not valid).
219219 """
220- user = model_project .User (TEST_USER , TEST_DISPLAY_NAME , "test_pass" , TEST_EMAIL2 , False , TEST_ROLE )
220+ user = model_project .User (TEST_USER , TEST_DISPLAY_NAME , TEST_PASS , TEST_EMAIL2 , False , TEST_ROLE )
221221 dao .store_entity (user )
222222 assert not self .user_service .is_username_valid (TEST_USER ), "Should be False but got True"
223223 assert self .user_service .is_username_valid ("test_user2" ), "Should be True but got False"
@@ -226,42 +226,42 @@ def test_validate_user_happy_flow(self):
226226 """
227227 Standard flow for a validate user action.
228228 """
229- user = model_project .User (TEST_USER , TEST_DISPLAY_NAME , "test_pass" , TEST_EMAIL2 , False , TEST_ROLE )
229+ user = model_project .User (TEST_USER , TEST_DISPLAY_NAME , TEST_PASS , TEST_EMAIL2 , False , TEST_ROLE )
230230 dao .store_entity (user )
231231 assert self .user_service .validate_user (TEST_USER ), "Validation failed when it shouldn't have."
232232
233233 def test_validate_user_validated (self ):
234234 """
235235 Flow for trying to validate a user that was already validated.
236236 """
237- user = model_project .User (TEST_USER , TEST_DISPLAY_NAME , "test_pass" , TEST_EMAIL2 , True , TEST_ROLE )
237+ user = model_project .User (TEST_USER , TEST_DISPLAY_NAME , TEST_PASS , TEST_EMAIL2 , True , TEST_ROLE )
238238 dao .store_entity (user )
239239 assert not self .user_service .validate_user (TEST_USER ), "Validation invalid."
240240
241241 def test_validate_user_non_existent (self ):
242242 """
243243 Flow for trying to validate a user that doesn't exist in the database.
244244 """
245- user = model_project .User (TEST_USER , TEST_DISPLAY_NAME , "test_pass" , TEST_EMAIL2 , True , TEST_ROLE )
245+ user = model_project .User (TEST_USER , TEST_DISPLAY_NAME , TEST_PASS , TEST_EMAIL2 , True , TEST_ROLE )
246246 dao .store_entity (user )
247247 assert not self .user_service .validate_user ("test_user2" ), "Validation done even tho user is non-existent"
248248
249249 def test_check_login_happy_flow (self ):
250250 """
251251 Standard login flow with a valid username and password.
252252 """
253- user = model_project .User (TEST_USER , 'test_name' , hash_password ("test_pass" ), TEST_EMAIL2 , True ,
253+ user = model_project .User (TEST_USER , 'test_name' , hash_password (TEST_PASS ), TEST_EMAIL2 , True ,
254254 TEST_ROLE )
255255 dao .store_entity (user )
256256 available_users = dao .get_all_users ()
257257 assert 2 == len (available_users )
258- assert self .user_service .check_login (TEST_USER , "test_pass" ) is not None , "Login failed when it shouldn't."
258+ assert self .user_service .check_login (TEST_USER , TEST_PASS ) is not None , "Login failed when it shouldn't."
259259
260260 def test_check_login_bad_pass (self ):
261261 """
262262 Flow for entering a bad/invalid password.
263263 """
264- user = model_project .User (TEST_USER , 'test_user_name' , hash_password ("test_pass" ), TEST_EMAIL2 , True ,
264+ user = model_project .User (TEST_USER , 'test_user_name' , hash_password (TEST_PASS ), TEST_EMAIL2 , True ,
265265 TEST_ROLE )
266266 dao .store_entity (user )
267267 available_users = dao .get_all_users ()
@@ -272,12 +272,12 @@ def test_check_login_bad_user(self):
272272 """
273273 Flow for entering a bad/invalid username.
274274 """
275- user = model_project .User (TEST_USER , 'test_name' , hash_password ("test_pass" ), TEST_EMAIL2 , True ,
275+ user = model_project .User (TEST_USER , 'test_name' , hash_password (TEST_PASS ), TEST_EMAIL2 , True ,
276276 TEST_ROLE )
277277 dao .store_entity (user )
278278 available_users = dao .get_all_users ()
279279 assert 2 == len (available_users )
280- assert self .user_service .check_login ("bad_user" , "test_pass" ) is None , "Login succeeded with bad userName."
280+ assert self .user_service .check_login ("bad_user" , TEST_PASS ) is None , "Login succeeded with bad userName."
281281
282282 def test_get_users_for_project (self ):
283283 """
0 commit comments