Fixed test_change_user_name and added test_list_users_project once again
This commit is contained in:
		
							parent
							
								
									44f6b31056
								
							
						
					
					
						commit
						13720d633f
					
				
					 1 changed files with 30 additions and 4 deletions
				
			
		
							
								
								
									
										34
									
								
								testing.py
									
										
									
									
									
								
							
							
						
						
									
										34
									
								
								testing.py
									
										
									
									
									
								
							|  | @ -394,12 +394,10 @@ def test_change_user_name(): | ||||||
|         headers={"Authorization": "Bearer " + admin_token}, |         headers={"Authorization": "Bearer " + admin_token}, | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|     # Login as admin |  | ||||||
| 
 |  | ||||||
|     # Change the user's name |     # Change the user's name | ||||||
|     response = requests.put( |     response = requests.put( | ||||||
|         getChangeUserNamePath, |         getChangeUserNamePath, | ||||||
|         json={"prevName": new_user, "newName": "new_username"}, |         json={"prevName": new_user, "newName": randomString()}, | ||||||
|         headers={"Authorization": "Bearer " + admin_token}, |         headers={"Authorization": "Bearer " + admin_token}, | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|  | @ -407,6 +405,34 @@ def test_change_user_name(): | ||||||
|     assert response.status_code == 200, "Change user name failed" |     assert response.status_code == 200, "Change user name failed" | ||||||
|     gprint("test_change_user_name successful") |     gprint("test_change_user_name successful") | ||||||
| 
 | 
 | ||||||
|  | def test_list_all_users_project(): | ||||||
|  |     # Log in as a user who is a member of the project | ||||||
|  |     admin_username = randomString() | ||||||
|  |     admin_password = "admin_password2" | ||||||
|  |     dprint( | ||||||
|  |         "Registering with username: ", admin_username, " and password: ", admin_password | ||||||
|  |     ) | ||||||
|  |     response = requests.post( | ||||||
|  |         registerPath, json={"username": admin_username, "password": admin_password} | ||||||
|  |     ) | ||||||
|  |     dprint(response.text) | ||||||
|  | 
 | ||||||
|  |     # Log in as the admin | ||||||
|  |     admin_token = login(admin_username, admin_password).json()["token"] | ||||||
|  |     response = requests.post( | ||||||
|  |         promoteToAdminPath, | ||||||
|  |         json={"username": admin_username}, | ||||||
|  |         headers={"Authorization": "Bearer " + admin_token}, | ||||||
|  |     ) | ||||||
|  | 
 | ||||||
|  |     # Make a request to list all users associated with the project | ||||||
|  |     response = requests.get( | ||||||
|  |         getUsersProjectPath + "/" + projectName, | ||||||
|  |         headers={"Authorization": "Bearer " + admin_token},     | ||||||
|  |     ) | ||||||
|  |     assert response.status_code == 200, "List all users project failed" | ||||||
|  |     gprint("test_list_all_users_project sucessful") | ||||||
|  | 
 | ||||||
| if __name__ == "__main__": | if __name__ == "__main__": | ||||||
|     test_get_user_projects() |     test_get_user_projects() | ||||||
|     test_create_user() |     test_create_user() | ||||||
|  | @ -420,6 +446,6 @@ if __name__ == "__main__": | ||||||
|     test_get_weekly_reports_user() |     test_get_weekly_reports_user() | ||||||
|     test_check_if_project_manager() |     test_check_if_project_manager() | ||||||
|     test_ProjectRoleChange() |     test_ProjectRoleChange() | ||||||
|     #test_list_all_users_project() |  | ||||||
|     test_ensure_manager_of_created_project() |     test_ensure_manager_of_created_project() | ||||||
|  |     test_list_all_users_project() | ||||||
|     test_change_user_name() |     test_change_user_name() | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 dDogge
						dDogge