Skip to content

Commit 0c1d7b6

Browse files
Added unit test cases
1 parent ab035f8 commit 0c1d7b6

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

internal/commands/scan_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2442,3 +2442,11 @@ func Test_CreateScanWithSbomFlag(t *testing.T) {
24422442

24432443
assert.ErrorContains(t, err, "Failed creating a scan: Input in bad format: failed to read file:")
24442444
}
2445+
2446+
func Test_CreateScanWithIgnorePolicyFlag(t *testing.T) {
2447+
err := execCmdNotNilAssertion(
2448+
t,
2449+
"scan", "create", "--project-name", "MOCK", "-s", "data/sources.zip", "--branch", "dummy_branch", "--ignore-policy",
2450+
)
2451+
assert.ErrorContains(t, err, "You do not have permission to override policy enforcement. The --ignore-policy flag cannot be used without the 'override-policy-management' permission.")
2452+
}

internal/wrappers/mock/jwt-helper-mock.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ func (j *JWTMockWrapper) IsAllowedEngine(engine string) (bool, error) {
4141
}
4242

4343
func (j *JWTMockWrapper) CheckPermissionByAccessToken(requiredPermission string) (permission bool, err error) {
44-
return true, nil
44+
return false, nil
4545
}

0 commit comments

Comments
 (0)