Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of Test Case for Non-Existent Framework in GetFrameworkCmd #1533

Merged
merged 1 commit into from
Nov 26, 2023

Conversation

Umair0343
Copy link
Contributor

@Umair0343 Umair0343 commented Nov 26, 2023

Type

Tests


Description

This pull request introduces a new test case TestGetFrameworkCmdWithNonExistentFramework in the framework_test.go file. The main changes include:

  • Creation of a mock Kubescape interface and a ScanInfo object.
  • Calling the getFrameworkCmd function with the mock interface and ScanInfo object.
  • Running the command with a non-existent framework argument.
  • Checking that there is an error and the error message is "bad argument: account ID must be a valid UUID".
    This enhancement increases the test coverage of the getFrameworkCmd function and ensures that it correctly handles non-existent framework arguments.

PR changes walkthrough

Relevant files                                                                                                                                 
Tests
1 files
framework_test.go                                                                                     
    cmd/scan/framework_test.go

    A new test case
    `TestGetFrameworkCmdWithNonExistentFramework` has been added
    to test the behavior of the `getFrameworkCmd` function when
    it's run with a non-existent framework argument.
+19/-0

… GetFrameworkCmd)

Description:

This pull request introduces a new test case TestGetFrameworkCmdWithNonExistentFramework in the framework_test.go file. The purpose of this test case is to verify the behavior of the getFrameworkCmd function when it's run with a non-existent framework argument.

In this test case, we:

Create a mock Kubescape interface and a ScanInfo object
Call the getFrameworkCmd function with the mock interface and ScanInfo object
Run the command with a non-existent framework argument
Check that there is an error and the error message is "bad argument: account ID must be a valid UUID"

This test case enhances the test coverage of the getFrameworkCmd function and ensures that it correctly handles non-existent framework arguments.

Signed-off-by: Umair <58398786+Umair0343@users.noreply.github.com>
@matthyx matthyx merged commit 5ef720b into kubescape:master Nov 26, 2023
10 of 11 checks passed
VaibhavMalik4187 added a commit to VaibhavMalik4187/kubescape that referenced this pull request Nov 30, 2023
Updated the `getSortPackageScores` function to fix the crash in the scan
command.

Fixes: kubescape#1533

Signed-off-by: VaibhavMalik4187 <vaibhavmalik2018@gmail.com>
@Umair0343
Copy link
Contributor Author

/describe

@github-actions github-actions bot changed the title Update framework_test.go (Add Test Case for Non-Existent Framework in… Addition of Test Case for Non-Existent Framework in GetFrameworkCmd Dec 9, 2023
Copy link

github-actions bot commented Dec 9, 2023

PR Description updated to latest commit (5172ce3)

@github-actions github-actions bot added the Tests label Dec 9, 2023
@Umair0343
Copy link
Contributor Author

/describe
--pr_description.extra_instructions="
For the title, use the format [type]: [summary]
"
--pr_description.generate_ai_title=true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants