diff --git a/backend/internal/database/db.go b/backend/internal/database/db.go index fd0a083..3f2d2f7 100644 --- a/backend/internal/database/db.go +++ b/backend/internal/database/db.go @@ -40,6 +40,8 @@ type Database interface { IsSiteAdmin(username string) (bool, error) IsProjectManager(username string, projectname string) (bool, error) GetTotalTimePerActivity(projectName string) (map[string]int, error) + + } // This struct is a wrapper type that holds the database connection @@ -61,16 +63,14 @@ var sampleData embed.FS // TODO: Possibly break these out into separate files bundled with the embed package? const userInsert = "INSERT INTO users (username, password) VALUES (?, ?)" -const projectInsert = "INSERT INTO projects (name, description, owner_user_id) VALUES (?, ?, (SELECT id FROM users WHERE username = ?))" +const projectInsert = "INSERT INTO projects (name, description, owner_user_id) SELECT ?, ?, id FROM users WHERE username = ?" const promoteToAdmin = "INSERT INTO site_admin (admin_id) SELECT id FROM users WHERE username = ?" const addWeeklyReport = `WITH UserLookup AS (SELECT id FROM users WHERE username = ?), ProjectLookup AS (SELECT id FROM projects WHERE name = ?) INSERT INTO weekly_reports (project_id, user_id, week, development_time, meeting_time, admin_time, own_work_time, study_time, testing_time) VALUES ((SELECT id FROM ProjectLookup), (SELECT id FROM UserLookup),?, ?, ?, ?, ?, ?, ?);` -const addUserToProject = `INSERT OR IGNORE INTO user_roles (user_id, project_id, p_role) - VALUES ((SELECT id FROM users WHERE username = ?), - (SELECT id FROM projects WHERE name = ?), ?)` -const changeUserRole = "UPDATE user_roles SET p_role = ? WHERE user_id = (SELECT id FROM users WHERE username = ?) AND project_id = (SELECT id FROM projects WHERE name = ?)" +const addUserToProject = "INSERT INTO user_roles (user_id, project_id, p_role) VALUES (?, ?, ?)" +const changeUserRole = "UPDATE user_roles SET p_role = ? WHERE user_id = ? AND project_id = ?" const getProjectsForUser = `SELECT p.id, p.name, p.description FROM projects p JOIN user_roles ur ON p.id = ur.project_id JOIN users u ON ur.user_id = u.id @@ -78,11 +78,6 @@ const getProjectsForUser = `SELECT p.id, p.name, p.description FROM projects p const deleteProject = `DELETE FROM projects WHERE id = ? AND owner_username = ?` -const isProjectManagerQuery = `SELECT COUNT(*) > 0 FROM user_roles - JOIN users ON user_roles.user_id = users.id - JOIN projects ON user_roles.project_id = projects.id - WHERE users.username = ? AND projects.name = ? AND user_roles.p_role = 'project_manager'` - // DbConnect connects to the database func DbConnect(dbpath string) Database { // Open the database @@ -140,15 +135,41 @@ func (d *Db) AddWeeklyReport(projectName string, userName string, week int, deve // AddUserToProject adds a user to a project with a specified role. func (d *Db) AddUserToProject(username string, projectname string, role string) error { - _, err := d.Exec(addUserToProject, username, projectname, role) - return err + var userid int + userid, err := d.GetUserId(username) + if err != nil { + panic(err) + } + + var projectid int + projectid, err2 := d.GetProjectId(projectname) + if err2 != nil { + panic(err2) + } + + _, err3 := d.Exec(addUserToProject, userid, projectid, role) + return err3 } // ChangeUserRole changes the role of a user within a project. func (d *Db) ChangeUserRole(username string, projectname string, role string) error { + // Get the user ID + var userid int + userid, err := d.GetUserId(username) + if err != nil { + panic(err) + } + + // Get the project ID + var projectid int + projectid, err2 := d.GetProjectId(projectname) + if err2 != nil { + panic(err2) + } + // Execute the SQL query to change the user's role - _, err := d.Exec(changeUserRole, role, username, projectname) - return err + _, err3 := d.Exec(changeUserRole, role, userid, projectid) + return err3 } // ChangeUserName changes the username of a user. @@ -197,7 +218,6 @@ func (d *Db) GetProjectId(projectname string) (int, error) { // Creates a new project in the database, associated with a user func (d *Db) AddProject(name string, description string, username string) error { tx := d.MustBegin() - // Insert the project into the database _, err := tx.Exec(projectInsert, name, description, username) if err != nil { if err := tx.Rollback(); err != nil { @@ -205,9 +225,7 @@ func (d *Db) AddProject(name string, description string, username string) error } return err } - - // Add creator to project as project manager - _, err = tx.Exec(addUserToProject, username, name, "project_manager") + _, err = tx.Exec(changeUserRole, "project_manager", username, name) if err != nil { if err := tx.Rollback(); err != nil { return err @@ -447,9 +465,23 @@ func (d *Db) GetWeeklyReportsUser(username string, projectName string) ([]types. // IsProjectManager checks if a given username is a project manager for the specified project func (d *Db) IsProjectManager(username string, projectname string) (bool, error) { - var manager bool - err := d.Get(&manager, isProjectManagerQuery, username, projectname) - return manager, err + // Define the SQL query to check if the user is a project manager for the project + query := ` + SELECT COUNT(*) FROM user_roles + JOIN users ON user_roles.user_id = users.id + JOIN projects ON user_roles.project_id = projects.id + WHERE users.username = ? AND projects.name = ? AND user_roles.p_role = 'project_manager' + ` + + // Execute the query + var count int + err := d.Get(&count, query, username, projectname) + if err != nil { + return false, err + } + + // If count is greater than 0, the user is a project manager for the project + return count > 0, nil } // MigrateSampleData applies sample data to the database. @@ -492,39 +524,39 @@ func (d *Db) MigrateSampleData() error { } func (d *Db) GetTotalTimePerActivity(projectName string) (map[string]int, error) { - - query := ` + + query := ` SELECT development_time, meeting_time, admin_time, own_work_time, study_time, testing_time FROM weekly_reports JOIN projects ON weekly_reports.project_id = projects.id WHERE projects.name = ? ` + + rows, err := d.DB.Query(query, projectName) + if err != nil { + return nil, err + } + defer rows.Close() - rows, err := d.DB.Query(query, projectName) - if err != nil { - return nil, err - } - defer rows.Close() + totalTime := make(map[string]int) - totalTime := make(map[string]int) + for rows.Next() { + var developmentTime, meetingTime, adminTime, ownWorkTime, studyTime, testingTime int + if err := rows.Scan(&developmentTime, &meetingTime, &adminTime, &ownWorkTime, &studyTime, &testingTime); err != nil { + return nil, err + } + + totalTime["development"] += developmentTime + totalTime["meeting"] += meetingTime + totalTime["admin"] += adminTime + totalTime["own_work"] += ownWorkTime + totalTime["study"] += studyTime + totalTime["testing"] += testingTime + } - for rows.Next() { - var developmentTime, meetingTime, adminTime, ownWorkTime, studyTime, testingTime int - if err := rows.Scan(&developmentTime, &meetingTime, &adminTime, &ownWorkTime, &studyTime, &testingTime); err != nil { - return nil, err - } + if err := rows.Err(); err != nil { + return nil, err + } - totalTime["development"] += developmentTime - totalTime["meeting"] += meetingTime - totalTime["admin"] += adminTime - totalTime["own_work"] += ownWorkTime - totalTime["study"] += studyTime - totalTime["testing"] += testingTime - } - - if err := rows.Err(); err != nil { - return nil, err - } - - return totalTime, nil + return totalTime, nil } diff --git a/backend/internal/database/db_test.go b/backend/internal/database/db_test.go index 139fba9..df10abc 100644 --- a/backend/internal/database/db_test.go +++ b/backend/internal/database/db_test.go @@ -1,6 +1,7 @@ package database import ( + "fmt" "testing" ) @@ -16,61 +17,12 @@ func setupState() (Database, error) { return db, nil } -// This is a more advanced setup that includes more data in the database. -// This is useful for more complex testing scenarios. -func setupAdvancedState() (Database, error) { - db, err := setupState() - if err != nil { - return nil, err - } - - // Add a user - if err = db.AddUser("demouser", "password"); err != nil { - return nil, err - } - - // Add a project - if err = db.AddProject("projecttest", "description", "demouser"); err != nil { - return nil, err - } - - // Add a weekly report - if err = db.AddWeeklyReport("projecttest", "demouser", 1, 1, 1, 1, 1, 1, 1); err != nil { - return nil, err - } - - return db, nil -} - // TestDbConnect tests the connection to the database func TestDbConnect(t *testing.T) { db := DbConnect(":memory:") _ = db } -func TestSetupAdvancedState(t *testing.T) { - db, err := setupAdvancedState() - if err != nil { - t.Error("setupAdvancedState failed:", err) - } - - // Check if the user was added - if _, err = db.GetUserId("demouser"); err != nil { - t.Error("GetUserId failed:", err) - } - - // Check if the project was added - projects, err := db.GetAllProjects() - if err != nil { - t.Error("GetAllProjects failed:", err) - } - if len(projects) != 1 { - t.Error("GetAllProjects failed: expected 1, got", len(projects)) - } - - // To be continued... -} - // TestDbAddUser tests the AddUser function of the database func TestDbAddUser(t *testing.T) { db, err := setupState() @@ -106,12 +58,12 @@ func TestDbGetUserId(t *testing.T) { // TestDbAddProject tests the AddProject function of the database func TestDbAddProject(t *testing.T) { - db, err := setupAdvancedState() + db, err := setupState() if err != nil { t.Error("setupState failed:", err) } - err = db.AddProject("test", "description", "demouser") + err = db.AddProject("test", "description", "test") if err != nil { t.Error("AddProject failed:", err) } @@ -216,15 +168,20 @@ func TestChangeUserRole(t *testing.T) { t.Error("AddProject failed:", err) } + err = db.AddUserToProject("testuser", "testproject", "user") + if err != nil { + t.Error("AddUserToProject failed:", err) + } + role, err := db.GetUserRole("testuser", "testproject") if err != nil { t.Error("GetUserRole failed:", err) } - if role != "project_manager" { - t.Error("GetUserRole failed: expected project_manager, got", role) + if role != "user" { + t.Error("GetUserRole failed: expected user, got", role) } - err = db.ChangeUserRole("testuser", "testproject", "member") + err = db.ChangeUserRole("testuser", "testproject", "admin") if err != nil { t.Error("ChangeUserRole failed:", err) } @@ -233,8 +190,8 @@ func TestChangeUserRole(t *testing.T) { if err != nil { t.Error("GetUserRole failed:", err) } - if role != "member" { - t.Error("GetUserRole failed: expected member, got", role) + if role != "admin" { + t.Error("GetUserRole failed: expected admin, got", role) } } @@ -523,6 +480,7 @@ func TestSignWeeklyReport(t *testing.T) { if err != nil { t.Error("GetUserId failed:", err) } + fmt.Println("Project Manager's ID:", projectManagerID) // Sign the report with the project manager err = db.SignWeeklyReport(report.ReportId, projectManagerID) @@ -561,7 +519,7 @@ func TestSignWeeklyReportByAnotherProjectManager(t *testing.T) { t.Error("AddUser failed:", err) } - // Add project, projectManager is the owner + // Add project err = db.AddProject("testproject", "description", "projectManager") if err != nil { t.Error("AddProject failed:", err) @@ -585,25 +543,14 @@ func TestSignWeeklyReportByAnotherProjectManager(t *testing.T) { t.Error("GetWeeklyReport failed:", err) } - managerID, err := db.GetUserId("projectManager") + anotherManagerID, err := db.GetUserId("projectManager") if err != nil { t.Error("GetUserId failed:", err) } - err = db.SignWeeklyReport(report.ReportId, managerID) - if err != nil { - t.Error("SignWeeklyReport failed:", err) - } - - // Retrieve the report again to check if it's signed - signedReport, err := db.GetWeeklyReport("testuser", "testproject", 1) - if err != nil { - t.Error("GetWeeklyReport failed:", err) - } - - // Ensure the report is signed by the project manager - if *signedReport.SignedBy != managerID { - t.Errorf("Expected SignedBy to be %d, got %d", managerID, *signedReport.SignedBy) + err = db.SignWeeklyReport(report.ReportId, anotherManagerID) + if err == nil { + t.Error("Expected SignWeeklyReport to fail with a project manager who is not in the project, but it didn't") } } @@ -768,12 +715,6 @@ func TestEnsureManagerOfCreatedProject(t *testing.T) { t.Error("AddProject failed:", err) } - // Set user to a project manager - // err = db.AddUserToProject("testuser", "testproject", "project_manager") - // if err != nil { - // t.Error("AddUserToProject failed:", err) - // } - managerState, err := db.IsProjectManager("testuser", "testproject") if err != nil { t.Error("IsProjectManager failed:", err) diff --git a/backend/internal/handlers/handlers_project_related.go b/backend/internal/handlers/handlers_project_related.go index 603f4cd..99696e7 100644 --- a/backend/internal/handlers/handlers_project_related.go +++ b/backend/internal/handlers/handlers_project_related.go @@ -65,8 +65,8 @@ func (gs *GState) ProjectRoleChange(c *fiber.Ctx) error { //check token and get username of current user user := c.Locals("user").(*jwt.Token) claims := user.Claims.(jwt.MapClaims) - username := claims["name"].(string) - + projectManagerUsername := claims["name"].(string) + log.Info(projectManagerUsername) // Extract the necessary parameters from the request data := new(types.RoleChange) if err := c.BodyParser(data); err != nil { @@ -74,19 +74,18 @@ func (gs *GState) ProjectRoleChange(c *fiber.Ctx) error { return c.Status(400).SendString(err.Error()) } - log.Info("Changing role for user: ", username, " in project: ", data.Projectname, " to: ", data.Role) + // dubble diping and checcking if current user is - // Dubble diping and checcking if current user is - if ismanager, err := gs.Db.IsProjectManager(username, data.Projectname); err != nil { + if ismanager, err := gs.Db.IsProjectManager(projectManagerUsername, data.Projectname); err != nil { log.Warn("Error checking if projectmanager:", err) return c.Status(500).SendString(err.Error()) } else if !ismanager { - log.Warn("User is not projectmanager") - return c.Status(401).SendString("User is not projectmanager") + log.Warn("tried chaning role when not projectmanager:", err) + return c.Status(401).SendString("you can not change role when not projectManager") } // Change the user's role within the project in the database - if err := gs.Db.ChangeUserRole(username, data.Projectname, data.Role); err != nil { + if err := gs.Db.ChangeUserRole(data.Username, data.Projectname, data.Role); err != nil { return c.Status(500).SendString(err.Error()) } @@ -219,9 +218,7 @@ func (gs *GState) IsProjectManagerHandler(c *fiber.Ctx) error { username := claims["name"].(string) // Extract necessary parameters from the request query string - projectName := c.Params("projectName") - - log.Info("Checking if user ", username, " is a project manager for project ", projectName) + projectName := c.Query("projectName") // Check if the user is a project manager for the specified project isManager, err := gs.Db.IsProjectManager(username, projectName) @@ -231,5 +228,10 @@ func (gs *GState) IsProjectManagerHandler(c *fiber.Ctx) error { } // Return the result as JSON - return c.JSON(fiber.Map{"isProjectManager": isManager}) + return c.JSON(map[string]bool{"isProjectManager": isManager}) +} + +func (gs *GState) CreateTask(c *fiber.Ctx) error { + + return nil } diff --git a/backend/internal/types/project.go b/backend/internal/types/project.go index 2e26eb9..6a7c91a 100644 --- a/backend/internal/types/project.go +++ b/backend/internal/types/project.go @@ -14,12 +14,9 @@ type NewProject struct { Description string `json:"description"` } -// Used to change the role of a user in a project. -// If name is identical to the name contained in the token, the role can be changed. -// If the name is different, only a project manager can change the role. type RoleChange struct { - UserName string `json:"username"` Role string `json:"role" tstype:"'project_manager' | 'user'"` + Username string `json:"username"` Projectname string `json:"projectname"` } diff --git a/frontend/src/API/API.ts b/frontend/src/API/API.ts index 47299f3..cfb53b0 100644 --- a/frontend/src/API/API.ts +++ b/frontend/src/API/API.ts @@ -7,102 +7,52 @@ import { WeeklyReport, } from "../Types/goTypes"; -/** - * Response object returned by API methods. - */ +// This type of pattern should be hard to misuse export interface APIResponse { - /** Indicates whether the API call was successful */ success: boolean; - /** Optional message providing additional information or error description */ message?: string; - /** Optional data returned by the API method */ data?: T; } -/** - * Interface defining methods that an instance of the API must implement. - */ +// Note that all protected routes also require a token +// Defines all the methods that an instance of the API must implement interface API { - /** - * Register a new user - * @param {NewUser} user The user object to be registered - * @returns {Promise>} A promise containing the API response with the user data. - */ + /** Register a new user */ registerUser(user: NewUser): Promise>; - - /** - * Removes a user. - * @param {string} username The username of the user to be removed. - * @param {string} token The authentication token. - * @returns {Promise>} A promise containing the API response with the removed user data. - */ + /** Remove a user */ removeUser(username: string, token: string): Promise>; - - /** - * Check if user is project manager. - * @param {string} username The username of the user. - * @param {string} projectName The name of the project. - * @param {string} token The authentication token. - * @returns {Promise>} A promise containing the API response indicating if the user is a project manager. - */ + /** Check if user is project manager */ checkIfProjectManager( username: string, projectName: string, token: string, ): Promise>; - - /** Logs in a user with the provided credentials. - * @param {NewUser} NewUser The user object containing username and password. - * @returns {Promise>} A promise resolving to an API response with a token. - */ + /** Login */ login(NewUser: NewUser): Promise>; - - /** - * Renew the token - * @param {string} token The current authentication token. - * @returns {Promise>} A promise resolving to an API response with a renewed token. - */ + /** Renew the token */ renewToken(token: string): Promise>; - /** Promote user to admin */ - - /** Creates a new project. - * @param {NewProject} project The project object containing name and description. - * @param {string} token The authentication token. - * @returns {Promise>} A promise resolving to an API response with the created project. - */ + /** Create a project */ createProject( project: NewProject, token: string, ): Promise>; - - /** Submits a weekly report - * @param {NewWeeklyReport} weeklyReport The weekly report object. - * @param {string} token The authentication token. - * @returns {Promise>} A promise resolving to an API response with the submitted report. - */ + /** Submit a weekly report */ submitWeeklyReport( - weeklyReport: NewWeeklyReport, + project: NewWeeklyReport, token: string, ): Promise>; - - /** Gets a weekly report for a specific user, project and week - * @param {string} username The username of the user. - * @param {string} projectName The name of the project. - * @param {string} week The week number. - * @param {string} token The authentication token. - * @returns {Promise>} A promise resolving to an API response with the retrieved report. - */ + /**Gets a weekly report*/ getWeeklyReport( username: string, projectName: string, week: string, token: string, ): Promise>; - /** * Returns all the weekly reports for a user in a particular project * The username is derived from the token + * * @param {string} projectName The name of the project * @param {string} token The token of the user * @returns {APIResponse} A list of weekly reports @@ -111,27 +61,15 @@ interface API { projectName: string, token: string, ): Promise>; - - /** Gets all the projects of a user - * @param {string} token - The authentication token. - * @returns {Promise>} A promise containing the API response with the user's projects. - */ + /** Gets all the projects of a user*/ getUserProjects(token: string): Promise>; - - /** Gets a project by its id. - * @param {number} id The id of the project to retrieve. - * @returns {Promise>} A promise resolving to an API response containing the project data. - */ + /** Gets a project from id*/ getProject(id: number): Promise>; - - /** Gets a list of all users. - * @param {string} token The authentication token of the requesting user. - * @returns {Promise>} A promise resolving to an API response containing the list of users. - */ + /** Gets a project from id*/ getAllUsers(token: string): Promise>; } -/** An instance of the API */ +// Export an instance of the API export const api: API = { async registerUser(user: NewUser): Promise> { try { @@ -398,6 +336,7 @@ export const api: API = { } }, + // Gets a projet by id, currently untested since we have no javascript-based tests async getProject(id: number): Promise> { try { const response = await fetch(`/api/project/${id}`, { @@ -423,6 +362,7 @@ export const api: API = { } }, + // Gets all users async getAllUsers(token: string): Promise> { try { const response = await fetch("/api/users/all", { diff --git a/frontend/src/Components/AddProject.tsx b/frontend/src/Components/AddProject.tsx index f5f4a08..45814e3 100644 --- a/frontend/src/Components/AddProject.tsx +++ b/frontend/src/Components/AddProject.tsx @@ -7,7 +7,7 @@ import Button from "./Button"; /** * Tries to add a project to the system - * @param {Object} props - Project name and description + * @param props - Project name and description * @returns {boolean} True if created, false if not */ function CreateProject(props: { name: string; description: string }): boolean { @@ -34,8 +34,8 @@ function CreateProject(props: { name: string; description: string }): boolean { } /** - * Provides UI for adding a project to the system. - * @returns {JSX.Element} - Returns the component UI for adding a project + * Tries to add a project to the system + * @returns {JSX.Element} UI for project adding */ function AddProject(): JSX.Element { const [name, setName] = useState(""); diff --git a/frontend/src/Components/AllTimeReportsInProject.tsx b/frontend/src/Components/AllTimeReportsInProject.tsx index 614019c..1a34e41 100644 --- a/frontend/src/Components/AllTimeReportsInProject.tsx +++ b/frontend/src/Components/AllTimeReportsInProject.tsx @@ -7,7 +7,7 @@ import { api } from "../API/API"; /** * Renders a component that displays all the time reports for a specific project. - * @returns {JSX.Element} representing the component. + * @returns JSX.Element representing the component. */ function AllTimeReportsInProject(): JSX.Element { const { projectName } = useParams(); diff --git a/testing.py b/testing.py index 384d7ce..568cb87 100644 --- a/testing.py +++ b/testing.py @@ -20,8 +20,8 @@ def randomString(len=10): # Defined once per test run -username = "user_" + randomString() -projectName = "project_" + randomString() +username = randomString() +projectName = randomString() # The base URL of the API base_url = "http://localhost:8080" @@ -45,37 +45,30 @@ getUsersProjectPath = base_url + "/api/getUsersProject" #ta bort auth i handlern för att få testet att gå igenom def test_ProjectRoleChange(): dprint("Testing ProjectRoleChange") - localUsername = randomString() - localProjectName = randomString() - register(localUsername, "username_password") + project_manager = randomString() + register(project_manager, "project_manager_password") - token = login(localUsername, "username_password").json()[ + token = login(project_manager, "project_manager_password").json()[ "token" ] - - # Just checking since this test is built somewhat differently than the others - assert token != None, "Login failed" - response = requests.post( addProjectPath, - json={"name": localProjectName, "description": "This is a project"}, + json={"name": projectName, "description": "This is a project"}, headers={"Authorization": "Bearer " + token}, ) - - if response.status_code != 200: - print("Add project failed") - response = requests.post( ProjectRoleChangePath, headers={"Authorization": "Bearer " + token}, json={ - "projectName": localProjectName, - "role": "project_manager", + "username": username, + "projectName": projectName, + "week": 1 }, ) - - assert response.status_code == 200, "ProjectRoleChange failed" - gprint("test_ProjectRoleChange successful") + if response.status_code != 200: + print("auth not working, för att man inte kan få tag på pm token atm, för att få igenom det så ta bort auth i handler") + + assert response.status_code == 200, "change role successfully" def test_get_user_projects(): @@ -344,28 +337,33 @@ def test_check_if_project_manager(): assert response.status_code == 200, "Check if project manager failed" gprint("test_check_if_project_manager successful") -def test_ensure_manager_of_created_project(): - # Create a new user to add to the project - newUser = "karen_" + randomString() - newProject = "HR_" + randomString() - register(newUser, "new_user_password") - token = login(newUser, "new_user_password").json()["token"] - - # Create a new project +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( - addProjectPath, - json={"name": newProject, "description": "This is a project"}, - headers={"Authorization": "Bearer " + token}, + registerPath, json={"username": admin_username, "password": admin_password} ) - assert response.status_code == 200, "Add project failed" + dprint(response.text) - response = requests.get( - checkIfProjectManagerPath + "/" + newProject, - headers={"Authorization": "Bearer " + token}, + # 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}, ) - assert response.status_code == 200, "Check if project manager failed" - assert response.json()["isProjectManager"] == True, "User is not project manager" - gprint("test_ensure_admin_of_created_project successful") + + # 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__": @@ -381,5 +379,4 @@ if __name__ == "__main__": test_get_weekly_reports_user() test_check_if_project_manager() test_ProjectRoleChange() - #test_list_all_users_project() - test_ensure_manager_of_created_project() + test_list_all_users_project()