-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add tenant role validation (#61)
* fix: add tenant role validation * fix: linting issue by adding debug trace * fix: consistent capitalization 1/2 Co-authored-by: Matthew Rogers <matt.rogers@snyk.io> * fix: consistent capitalization 2/2 Co-authored-by: Matthew Rogers <matt.rogers@snyk.io> * chore: update test following capitalization --------- Co-authored-by: Matthew Rogers <matt.rogers@snyk.io>
- Loading branch information
Showing
7 changed files
with
206 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
{ | ||
"API_HOSTNAME": "https://api.snyk.io", | ||
"API_VERSION":"2024-02-08~experimental", | ||
"API_VERSION_TENANTS": "2024-04-11~experimental", | ||
"API_VERSION_TENANTS": "2024-10-14~experimental", | ||
"APP_INSTALL_API_VERSION": "2024-05-31", | ||
"MAX_RETRY": 3, | ||
"LOG_LEVEL": "info" | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
test/workflows/deployments/get-failed-due-to-tenant-role.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import {captureOutput} from '@oclif/test' | ||
import {expect} from 'chai' | ||
import {stdin as fstdin} from 'mock-stdin' | ||
|
||
import Deployments from '../../../src/commands/workflows/deployments/get' | ||
import {beforeStep, orgId, snykToken} from '../../test-utils/nock-utils' | ||
import {sendScenario} from '../../test-utils/stdin-utils' | ||
|
||
describe('deployment workflows', () => { | ||
before(beforeStep) | ||
|
||
after(() => { | ||
delete process.env.TENANT_ID | ||
}) | ||
it('runs workflow deployment list', async () => { | ||
process.env.TENANT_ID = '00000000-0000-0000-0000-000000000001' | ||
const stdin = fstdin() | ||
// @ts-ignore | ||
const cfg: Config = {} | ||
const getDeployment = new Deployments([], cfg) | ||
const {stdout, stderr, error} = await captureOutput( | ||
async () => { | ||
sendScenario(stdin, [snykToken, 'n', orgId]) | ||
|
||
return getDeployment.run() | ||
}, | ||
{print: false}, | ||
) | ||
expect(error?.message).to.contain( | ||
'This tool requires Tenant Admin role. Please use a Tenant level Admin account or upgrade your account to be Tenant Admin.', | ||
) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"root":["./src/base-command.ts","./src/index.ts","./src/types.ts","./src/api/apps.ts","./src/api/connections.ts","./src/api/credentials.ts","./src/api/deployments.ts","./src/api/integrations-types.ts","./src/api/integrations-utils.ts","./src/api/integrations.ts","./src/api/snyk.ts","./src/api/tenants.ts","./src/api/types.ts","./src/command-helpers/connections/connections-flags.ts","./src/command-helpers/connections/flags.ts","./src/command-helpers/connections/parameters-capture.ts","./src/command-helpers/connections/type-params-mapping.ts","./src/command-helpers/connections/types.ts","./src/command-helpers/credentials/flags.ts","./src/command-helpers/deployments/flags.ts","./src/commands/connections/create.ts","./src/commands/connections/delete.ts","./src/commands/connections/list.ts","./src/commands/connections/update.ts","./src/commands/credentials/create.ts","./src/commands/credentials/delete.ts","./src/commands/credentials/list.ts","./src/commands/credentials/update.ts","./src/commands/deployments/create.ts","./src/commands/deployments/delete.ts","./src/commands/deployments/list.ts","./src/commands/deployments/update.ts","./src/commands/integrations/create.ts","./src/commands/integrations/delete.ts","./src/commands/integrations/list.ts","./src/commands/introduction/index.ts","./src/commands/workflows/connections/create.ts","./src/commands/workflows/connections/delete.ts","./src/commands/workflows/connections/disconnect.ts","./src/commands/workflows/connections/get.ts","./src/commands/workflows/connections/integrate.ts","./src/commands/workflows/connections/migrate.ts","./src/commands/workflows/credentials/create.ts","./src/commands/workflows/credentials/delete.ts","./src/commands/workflows/credentials/get.ts","./src/commands/workflows/deployments/create.ts","./src/commands/workflows/deployments/delete.ts","./src/commands/workflows/deployments/get.ts","./src/commands/workflows/deployments/update.ts","./src/common/args.ts","./src/common/rest-helpers.ts","./src/config/config.ts","./src/utils/auth.ts","./src/utils/display.ts","./src/utils/http-request.ts","./src/utils/input-validation.ts","./src/utils/logger.ts","./src/utils/utils.ts","./src/utils/validation.ts","./src/workflows/apps.ts"],"version":"5.7.2"} |