Fixing getWeeklyReport tests
This commit is contained in:
parent
9f20d46fa6
commit
9070846b0b
3 changed files with 3 additions and 5 deletions
|
@ -39,11 +39,8 @@ func (gs *GState) GetWeeklyReport(c *fiber.Ctx) error {
|
||||||
// Extract the necessary parameters from the request
|
// Extract the necessary parameters from the request
|
||||||
println("GetWeeklyReport")
|
println("GetWeeklyReport")
|
||||||
user := c.Locals("user").(*jwt.Token)
|
user := c.Locals("user").(*jwt.Token)
|
||||||
println(user)
|
|
||||||
claims := user.Claims.(jwt.MapClaims)
|
claims := user.Claims.(jwt.MapClaims)
|
||||||
println(claims)
|
|
||||||
username := claims["name"].(string)
|
username := claims["name"].(string)
|
||||||
println(username)
|
|
||||||
|
|
||||||
// Extract project name and week from query parameters
|
// Extract project name and week from query parameters
|
||||||
projectName := c.Query("projectName")
|
projectName := c.Query("projectName")
|
||||||
|
|
|
@ -78,6 +78,7 @@ func main() {
|
||||||
server.Post("/api/loginrenew", gs.LoginRenew)
|
server.Post("/api/loginrenew", gs.LoginRenew)
|
||||||
server.Delete("/api/userdelete/:username", gs.UserDelete) // Perhaps just use POST to avoid headaches
|
server.Delete("/api/userdelete/:username", gs.UserDelete) // Perhaps just use POST to avoid headaches
|
||||||
server.Post("/api/project", gs.CreateProject)
|
server.Post("/api/project", gs.CreateProject)
|
||||||
|
server.Get("/api/getWeeklyReport", gs.GetWeeklyReport)
|
||||||
|
|
||||||
// Announce the port we are listening on and start the server
|
// Announce the port we are listening on and start the server
|
||||||
err = server.Listen(fmt.Sprintf(":%d", conf.Port))
|
err = server.Listen(fmt.Sprintf(":%d", conf.Port))
|
||||||
|
|
|
@ -75,7 +75,7 @@ def test_submit_report():
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
submitReportPath,
|
submitReportPath,
|
||||||
json={
|
json={
|
||||||
"projectName": "report1",
|
"projectName": projectName,
|
||||||
"week": 1,
|
"week": 1,
|
||||||
"developmentTime": 10,
|
"developmentTime": 10,
|
||||||
"meetingTime": 5,
|
"meetingTime": 5,
|
||||||
|
@ -95,7 +95,7 @@ def test_get_weekly_report():
|
||||||
response = requests.get(
|
response = requests.get(
|
||||||
getWeeklyReportPath,
|
getWeeklyReportPath,
|
||||||
headers={"Authorization": "Bearer " + token},
|
headers={"Authorization": "Bearer " + token},
|
||||||
params={"username": username, "projectName": "report1", "week": 1}
|
params={"username": username, "projectName": projectName , "week": 1}
|
||||||
)
|
)
|
||||||
print(response.text)
|
print(response.text)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue