Skip to content

Commit

Permalink
Add account contextType to rceConfig
Browse files Browse the repository at this point in the history
refs QUIZ-10424

test plan:
have New Quizzes set up
Build a new image from this source and tag it
so canvas-lms docker-compose will pick it up

docker build . -t instructure/canvas-rce-api

docker-compose down; docker-compose up -d

Open http://canvas.hello.docker/accounts/2/external_tools/2
Add a new Bank
Click on bank name
Add any question
RCE should come up with RCS feature enabled

Change-Id: I11dcf605592c1513609c8c5f54d5052910314dfe
Reviewed-on: https://gerrit.instructure.com/c/canvas-rce-api/+/305523
Tested-by: Service Cloud Jenkins <[email protected]>
Reviewed-by: Roland Beres <[email protected]>
QA-Review: Roland Beres <[email protected]>
Product-Review: Roland Beres <[email protected]>
  • Loading branch information
Rajmund Csehil committed Nov 17, 2022
1 parent d8c2d04 commit 42c7ca8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/api/rceConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ function canvasPath(request) {
return "user_id";
case "group":
return "group_id";
case "account":
return "account_id";
default:
throw new Error(`invalid contextType (${request.query.contextType})`);
}
Expand Down
7 changes: 7 additions & 0 deletions test/service/api/rceConfig.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ describe("RCE config API", () => {
assert.ok(path.match("/api/v1/services/rce_config\\?group_id=1"));
});

it("builds the correct path including with account_id parameter", () => {
const path = canvasPath({
query: { contextType: "account", contextId: "101230234" }
});
assert.ok(path.match("/api/v1/services/rce_config\\?account_id=101230234"));
});

it("throws error in case of missing context type", () => {
assert.throws(() => canvasPath({ query: { contextId: "1" } }));
});
Expand Down

0 comments on commit 42c7ca8

Please sign in to comment.