Skip to content

Commit 712906e

Browse files
committed
Fix authorize unit test
1 parent f44f5c0 commit 712906e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

coderd/coderd_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,11 @@ func TestAuthorizeAllEndpoints(t *testing.T) {
244244
"POST:/api/v2/csp/reports": {NoAuthorize: true},
245245
"GET:/api/v2/entitlements": {NoAuthorize: true},
246246

247-
"GET:/%40{user}/{workspacename}/apps/{application}/*": {
247+
"GET:/%40{user}/{workspacename_and_agent}/apps/{application}/*": {
248248
AssertAction: rbac.ActionRead,
249249
AssertObject: workspaceRBACObj,
250250
},
251-
"GET:/@{user}/{workspacename}/apps/{application}/*": {
251+
"GET:/@{user}/{workspacename_and_agent}/apps/{application}/*": {
252252
AssertAction: rbac.ActionRead,
253253
AssertObject: workspaceRBACObj,
254254
},
@@ -508,6 +508,7 @@ func TestAuthorizeAllEndpoints(t *testing.T) {
508508
route = strings.ReplaceAll(route, "{workspace}", workspace.ID.String())
509509
route = strings.ReplaceAll(route, "{workspacebuild}", workspace.LatestBuild.ID.String())
510510
route = strings.ReplaceAll(route, "{workspacename}", workspace.Name)
511+
route = strings.ReplaceAll(route, "{workspacename_and_agent}", workspace.Name+"."+workspaceResources[0].Agents[0].Name)
511512
route = strings.ReplaceAll(route, "{workspacebuildname}", workspace.LatestBuild.Name)
512513
route = strings.ReplaceAll(route, "{workspaceagent}", workspaceResources[0].Agents[0].ID.String())
513514
route = strings.ReplaceAll(route, "{buildnumber}", strconv.FormatInt(int64(workspace.LatestBuild.BuildNumber), 10))

0 commit comments

Comments
 (0)