bug fix getUnsignedReports
This commit is contained in:
parent
c466a98b15
commit
bcb661dc22
2 changed files with 9 additions and 2 deletions
|
@ -137,6 +137,11 @@ func (gs *GState) GetUnsignedReports(c *fiber.Ctx) error {
|
||||||
log.Info("Failed to get project manager ID")
|
log.Info("Failed to get project manager ID")
|
||||||
return c.Status(500).SendString("Failed to get project manager ID")
|
return c.Status(500).SendString("Failed to get project manager ID")
|
||||||
}
|
}
|
||||||
|
if !isProjectManager {
|
||||||
|
log.Info("User is not a project manager")
|
||||||
|
return c.Status(401).SendString("User is not a project manager")
|
||||||
|
}
|
||||||
|
|
||||||
log.Info("User is Project Manager: ", isProjectManager)
|
log.Info("User is Project Manager: ", isProjectManager)
|
||||||
|
|
||||||
// Call the database function to get the unsigned weekly reports
|
// Call the database function to get the unsigned weekly reports
|
||||||
|
|
|
@ -505,18 +505,20 @@ def test_remove_project():
|
||||||
|
|
||||||
def test_get_unsigned_reports():
|
def test_get_unsigned_reports():
|
||||||
# Log in as the user
|
# Log in as the user
|
||||||
token = login("user2", "123").json()["token"]
|
token = login("admin", "123").json()["token"]
|
||||||
|
|
||||||
# Make a request to get all unsigned reports
|
# Make a request to get all unsigned reports
|
||||||
response = requests.get(
|
response = requests.get(
|
||||||
getUnsignedReportsPath + "/" + projectName,
|
getUnsignedReportsPath + "/" "projecttest",
|
||||||
headers={"Authorization": "Bearer " + token},
|
headers={"Authorization": "Bearer " + token},
|
||||||
)
|
)
|
||||||
|
dprint(response.text)
|
||||||
assert response.status_code == 200, "Get unsigned reports failed"
|
assert response.status_code == 200, "Get unsigned reports failed"
|
||||||
gprint("test_get_unsigned_reports successful")
|
gprint("test_get_unsigned_reports successful")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
test_get_unsigned_reports()
|
||||||
test_remove_project()
|
test_remove_project()
|
||||||
test_get_user_projects()
|
test_get_user_projects()
|
||||||
test_create_user()
|
test_create_user()
|
||||||
|
|
Loading…
Reference in a new issue