cloudapi: add helper method to extract tenant channel from echo.Context

Extract the determination of tenant channel into a helper function.
This will simplify handler and middleware  methods, which won't have
to implement the same logic by themselves.

Fix the multi-tenancy unit test to pass the appropriate context when
querying compose statuses, because the server that is being use has JWT
enabled and expects the tenant to be set in it.
This commit is contained in:
Tomas Hozza 2022-06-03 17:30:32 +02:00 committed by Tom Gundersen
parent 947a083aae
commit 6fa2aa7b4a
3 changed files with 25 additions and 10 deletions

View file

@ -267,6 +267,7 @@ func TestMultitenancy(t *testing.T) {
resp := test.APICall{
Handler: handler,
Method: http.MethodGet,
Context: reqContext(c.orgID),
Path: "/api/image-builder-composer/v2/composes/" + c.id.String(),
ExpectedStatus: http.StatusOK,
}.Do(t)