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

AST-36690 | cleanup integration test #671

Merged
merged 9 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions test/integration/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,14 @@ func TestProjectCreate_ApplicationDoesntExist_FailAndReturnErrorMessage(t *testi

func TestProjectCreate_ApplicationExists_CreateProjectSuccessfully(t *testing.T) {

err, _ := executeCommand(
err, outBuffer := executeCommand(
t, "project", "create", flag(params.FormatFlag),
printer.FormatJSON, flag(params.ProjectName), projectNameRandom,
flag(params.ApplicationName), "my-application",
)

createdProject := wrappers.ProjectResponseModel{}
OrShamirCM marked this conversation as resolved.
Show resolved Hide resolved
unmarshall(t, outBuffer, &createdProject, "Reading project create response JSON should pass")
defer deleteProject(t, createdProject.ID)
assert.NilError(t, err)
OrShamirCM marked this conversation as resolved.
Show resolved Hide resolved
}

Expand Down
13 changes: 7 additions & 6 deletions test/integration/scan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestScanCreateEmptyProjectName(t *testing.T) {
assertError(t, err, "Project name is required") // Creating a scan with empty project name should fail
}

func TestScanCreate_ExistingApplicationAndExistingProject_CreateScanSuccessfully(t *testing.T) {
func TestScanCreateUpdateProjectWithApplication(t *testing.T) {
args := []string{
"scan", "create",
flag(params.ApplicationName), "my-application",
Expand All @@ -82,7 +82,7 @@ func TestScanCreate_ExistingApplicationAndExistingProject_CreateScanSuccessfully
assert.NilError(t, err)
}

func TestScanCreate_ExistingApplicationAndNotExistingProject_CreatingNewProjectAndCreateScanSuccessfully(t *testing.T) {
func TestScanCreateWithApplication(t *testing.T) {
OrShamirCM marked this conversation as resolved.
Show resolved Hide resolved
args := []string{
"scan", "create",
flag(params.ApplicationName), "my-application",
Expand All @@ -91,12 +91,13 @@ func TestScanCreate_ExistingApplicationAndNotExistingProject_CreatingNewProjectA
flag(params.ScanTypes), "sast",
flag(params.BranchFlag), "dummy_branch",
}

err, _ := executeCommand(t, args...)
assert.NilError(t, err)
scanID, projectID := executeCreateScan(t, args)
defer deleteProject(t, projectID)
assert.Assert(t, scanID != "", "Scan ID should not be empty")
assert.Assert(t, projectID != "", "Project ID should not be empty")
}

func TestScanCreate_ApplicationDoesntExist_FailScanWithError(t *testing.T) {
func TestScanCreateApplicationDoesntExist(t *testing.T) {
args := []string{
"scan", "create",
flag(params.ApplicationName), "application-that-doesnt-exist",
Expand Down
Loading