Skip to content

Commit

Permalink
fix test according to latest update on the expected response on POST …
Browse files Browse the repository at this point in the history
…profile_repos (will not include repository info)
  • Loading branch information
eranturgeman committed Dec 15, 2024
1 parent b659ba6 commit 65f3ee7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 59 deletions.
55 changes: 0 additions & 55 deletions tests/testdata/configprofile/configProfileWithRepoExample.json

This file was deleted.

8 changes: 4 additions & 4 deletions tests/xscconfigprofile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func TestGetConfigurationProfileByUrl(t *testing.T) {
configProfile, err := configProfileService.GetConfigurationProfileByUrl(mockServer.URL)
assert.NoError(t, err)

profileFileContent, err := os.ReadFile("testdata/configprofile/configProfileWithRepoExample.json")
profileFileContent, err := os.ReadFile("testdata/configprofile/configProfileExample.json")
assert.NoError(t, err)
var configProfileForComparison services.ConfigProfile
err = json.Unmarshal(profileFileContent, &configProfileForComparison)
Expand All @@ -66,16 +66,16 @@ func createXscMockServerForConfigProfile(t *testing.T, xrayVersion string) (mock
}

switch {
case strings.Contains(r.RequestURI, "/xsc/"+apiUrlPart+"profile/"+configProfileWithoutRepo):
case strings.Contains(r.RequestURI, "/xsc/"+apiUrlPart+"profile/"+configProfileWithoutRepo) && r.Method == http.MethodGet:
w.WriteHeader(http.StatusOK)
content, err := os.ReadFile("testdata/configprofile/configProfileExample.json")
assert.NoError(t, err)
_, err = w.Write(content)
assert.NoError(t, err)

case strings.Contains(r.RequestURI, "xray/api/v1/xsc/profile_repos") && isXrayAfterXscMigration:
case strings.Contains(r.RequestURI, "xray/api/v1/xsc/profile_repos") && r.Method == http.MethodPost && isXrayAfterXscMigration:
w.WriteHeader(http.StatusOK)
content, err := os.ReadFile("testdata/configprofile/configProfileWithRepoExample.json")
content, err := os.ReadFile("testdata/configprofile/configProfileExample.json")
assert.NoError(t, err)
_, err = w.Write(content)
assert.NoError(t, err)
Expand Down

0 comments on commit 65f3ee7

Please sign in to comment.