diff --git a/import-export-cli/integration/devFirst_test.go b/import-export-cli/integration/devFirst_test.go index 561f5600b..48451892e 100644 --- a/import-export-cli/integration/devFirst_test.go +++ b/import-export-cli/integration/devFirst_test.go @@ -220,13 +220,13 @@ func TestImportAndExportAPIWithDocument(t *testing.T) { projectPath, _ := filepath.Abs(projectName) //Move doc file to created project - srcPathForDoc, _ := filepath.Abs(testutils.TestCase1DocPath) - destPathForDoc := projectPath + testutils.TestCase1DestPathSuffix + srcPathForDoc, _ := filepath.Abs(testutils.DevFirstUpdatedSampleCaseDocPath) + destPathForDoc := projectPath + testutils.DevFirstUpdatedSampleCaseDestPathSuffix base.Copy(srcPathForDoc, destPathForDoc) //Move docMetaData file to created project - srcPathForDocMetadata, _ := filepath.Abs(testutils.TestCase1DocMetaDataPath) - destPathForDocMetaData := projectPath + testutils.TestCase1DestMetaDataPathSuffix + srcPathForDocMetadata, _ := filepath.Abs(testutils.DevFirstUpdatedSampleCaseDocMetaDataPath) + destPathForDocMetaData := projectPath + testutils.DevFirstUpdatedSampleCaseDestMetaDataPathSuffix base.Copy(srcPathForDocMetadata, destPathForDocMetaData) //Import the project with Document @@ -255,8 +255,8 @@ func TestImportAndExportAPIWithPngIcon(t *testing.T) { //Move icon file to created project projectPath, _ := filepath.Abs(projectName) - srcPathForIcon, _ := filepath.Abs(testutils.TestCase2PngPath) - destPathForIcon := projectPath + testutils.TestCase2DestPngPathSuffix + srcPathForIcon, _ := filepath.Abs(testutils.DevFirstSampleCasePngPath) + destPathForIcon := projectPath + testutils.DevFirstSampleCasePngPathSuffix base.Copy(srcPathForIcon, destPathForIcon) //Import the project with icon image(.png) @@ -285,8 +285,8 @@ func TestImportAndExportAPIWithJpegImage(t *testing.T) { //Move Image file to created project projectPath, _ := filepath.Abs(projectName) - srcPathForImage, _ := filepath.Abs(testutils.TestCase2JpegPath) - destPathForImage := projectPath + testutils.TestCase2DestJpegPathSuffix + srcPathForImage, _ := filepath.Abs(testutils.DevFirstUpdatedSampleCaseJpegPath) + destPathForImage := projectPath + testutils.DevFirstUpdatedSampleCaseDestJpegPathSuffix base.Copy(srcPathForImage, destPathForImage) //Import the project with icon image(.jpeg) provided @@ -315,26 +315,26 @@ func TestUpdateDocAndImageOfAPIOfExistingAPI(t *testing.T) { //Move doc file to created project projectPath, _ := filepath.Abs(projectName) - srcPathForDoc, _ := filepath.Abs(testutils.TestCase2DocPath) - destPathForDoc := projectPath + testutils.TestCase2DestPathSuffix + srcPathForDoc, _ := filepath.Abs(testutils.DevFirstSampleCaseDocPath) + destPathForDoc := projectPath + testutils.DevFirstSampleCaseDestPathSuffix base.Copy(srcPathForDoc, destPathForDoc) //Move Image file to created project - srcPathForImage, _ := filepath.Abs(testutils.TestCase2JpegPath) - destPathForImage := projectPath + testutils.TestCase2DestJpegPathSuffix + srcPathForImage, _ := filepath.Abs(testutils.DevFirstUpdatedSampleCaseJpegPath) + destPathForImage := projectPath + testutils.DevFirstUpdatedSampleCaseDestJpegPathSuffix base.Copy(srcPathForImage, destPathForImage) //Import the project with Document and image thumbnail testutils.ValidateImportUpdateProjectNotAlreadyImported(t, args) //Update doc file to created project - srcPathForDocUpdate, _ := filepath.Abs(testutils.TestCase1DocPath) - destPathForDocUpdate := projectPath + testutils.TestCase1DestPathSuffix + srcPathForDocUpdate, _ := filepath.Abs(testutils.DevFirstUpdatedSampleCaseDocPath) + destPathForDocUpdate := projectPath + testutils.DevFirstUpdatedSampleCaseDestPathSuffix base.Copy(srcPathForDocUpdate, destPathForDocUpdate) //Update docMetaData file to created project - srcPathForDocMetadataUpdate, _ := filepath.Abs(testutils.TestCase1DocMetaDataPath) - destPathForDocMetaDataUpdate := projectPath + testutils.TestCase1DestMetaDataPathSuffix + srcPathForDocMetadataUpdate, _ := filepath.Abs(testutils.DevFirstUpdatedSampleCaseDocMetaDataPath) + destPathForDocMetaDataUpdate := projectPath + testutils.DevFirstUpdatedSampleCaseDestMetaDataPathSuffix base.Copy(srcPathForDocMetadataUpdate, destPathForDocMetaDataUpdate) //Update icon file to created project @@ -343,8 +343,8 @@ func TestUpdateDocAndImageOfAPIOfExistingAPI(t *testing.T) { t.Fatal(err) } - srcPathForIcon, _ := filepath.Abs(testutils.TestCase2PngPath) - destPathForIcon := projectPath + testutils.TestCase2DestPngPathSuffix + srcPathForIcon, _ := filepath.Abs(testutils.DevFirstSampleCasePngPath) + destPathForIcon := projectPath + testutils.DevFirstSampleCasePngPathSuffix base.Copy(srcPathForIcon, destPathForIcon) base.WaitForIndexing() diff --git a/import-export-cli/integration/testdata/TestArtifactDirectory/ArtifactSet2/icon.png b/import-export-cli/integration/testdata/TestArtifactDirectory/DevFirstSampleCase/icon.png similarity index 100% rename from import-export-cli/integration/testdata/TestArtifactDirectory/ArtifactSet2/icon.png rename to import-export-cli/integration/testdata/TestArtifactDirectory/DevFirstSampleCase/icon.png diff --git a/import-export-cli/integration/testdata/TestArtifactDirectory/ArtifactSet2/mockPdf.pdf b/import-export-cli/integration/testdata/TestArtifactDirectory/DevFirstSampleCase/mockPdf.pdf similarity index 100% rename from import-export-cli/integration/testdata/TestArtifactDirectory/ArtifactSet2/mockPdf.pdf rename to import-export-cli/integration/testdata/TestArtifactDirectory/DevFirstSampleCase/mockPdf.pdf diff --git a/import-export-cli/integration/testdata/TestArtifactDirectory/ArtifactSet1/docs.yaml b/import-export-cli/integration/testdata/TestArtifactDirectory/DevFirstUpdatedSampleCaseArtifacts/docs.yaml similarity index 100% rename from import-export-cli/integration/testdata/TestArtifactDirectory/ArtifactSet1/docs.yaml rename to import-export-cli/integration/testdata/TestArtifactDirectory/DevFirstUpdatedSampleCaseArtifacts/docs.yaml diff --git a/import-export-cli/integration/testdata/TestArtifactDirectory/ArtifactSet2/icon.jpeg b/import-export-cli/integration/testdata/TestArtifactDirectory/DevFirstUpdatedSampleCaseArtifacts/icon.jpeg similarity index 100% rename from import-export-cli/integration/testdata/TestArtifactDirectory/ArtifactSet2/icon.jpeg rename to import-export-cli/integration/testdata/TestArtifactDirectory/DevFirstUpdatedSampleCaseArtifacts/icon.jpeg diff --git a/import-export-cli/integration/testdata/TestArtifactDirectory/ArtifactSet1/testDoc.pdf b/import-export-cli/integration/testdata/TestArtifactDirectory/DevFirstUpdatedSampleCaseArtifacts/testDoc.pdf similarity index 100% rename from import-export-cli/integration/testdata/TestArtifactDirectory/ArtifactSet1/testDoc.pdf rename to import-export-cli/integration/testdata/TestArtifactDirectory/DevFirstUpdatedSampleCaseArtifacts/testDoc.pdf diff --git a/import-export-cli/integration/testutils/devFirst_testUtils.go b/import-export-cli/integration/testutils/devFirst_testUtils.go index f7b434212..53965a491 100644 --- a/import-export-cli/integration/testutils/devFirst_testUtils.go +++ b/import-export-cli/integration/testutils/devFirst_testUtils.go @@ -190,7 +190,7 @@ func ValidateAPIWithDocIsExported(t *testing.T, args *InitTestArgs, DevFirstDefa relativePath := strings.ReplaceAll(exportedPath, ".zip", "") base.Unzip(relativePath, exportedPath) - docPathOfExportedApi := relativePath + TestDefaultExtractedFileName + TestCase1DestPathSuffix + docPathOfExportedApi := relativePath + TestDefaultExtractedFileName + DevFirstUpdatedSampleCaseDestPathSuffix //Check whether the file is available isDocExported := base.IsFileAvailable(docPathOfExportedApi) @@ -213,7 +213,7 @@ func ValidateAPIWithIconIsExported(t *testing.T, args *InitTestArgs, DevFirstDef relativePath := strings.ReplaceAll(exportedPath, ".zip", "") base.Unzip(relativePath, exportedPath) - iconPathOfExportedApi := relativePath + TestDefaultExtractedFileName + TestCase2DestPngPathSuffix + iconPathOfExportedApi := relativePath + TestDefaultExtractedFileName + DevFirstSampleCasePngPathSuffix isIconExported := base.IsFileAvailable(iconPathOfExportedApi) base.Log("Icon is Exported", isIconExported) @@ -235,7 +235,7 @@ func ValidateAPIWithImageIsExported(t *testing.T, args *InitTestArgs, DevFirstDe relativePath := strings.ReplaceAll(exportedPath, ".zip", "") base.Unzip(relativePath, exportedPath) - imagePathOfExportedApi := relativePath + TestDefaultExtractedFileName + TestCase2DestJpegPathSuffix + imagePathOfExportedApi := relativePath + TestDefaultExtractedFileName + DevFirstUpdatedSampleCaseDestJpegPathSuffix isIconExported := base.IsFileAvailable(imagePathOfExportedApi) base.Log("Image is Exported", isIconExported) assert.Equal(t, true, isIconExported, "Error while exporting API with icon") diff --git a/import-export-cli/integration/testutils/testConstants.go b/import-export-cli/integration/testutils/testConstants.go index 6a12d42c7..50ee5fb9c 100644 --- a/import-export-cli/integration/testutils/testConstants.go +++ b/import-export-cli/integration/testutils/testConstants.go @@ -31,16 +31,16 @@ const DefaultApictlTestAppName = "default-apictl-app" const DevFirstDefaultAPIName = "SwaggerPetstoreNew" const DevFirstSwagger2APIName = "PizzaShackAPI" const DevFirstDefaultAPIVersion = "1.0.0" -const TestCase1DocPath = "testdata/TestArtifactDirectory/ArtifactSet1/testDoc.pdf" -const TestCase1DestPathSuffix = "/Docs/FileContents/testDoc.pdf" -const TestCase2DocPath = "testdata/TestArtifactDirectory/ArtifactSet2/mockPdf.pdf" -const TestCase2DestPathSuffix = "/Docs/FileContents/mockPdf.pdf" -const TestCase1DocMetaDataPath = "testdata/TestArtifactDirectory/ArtifactSet1/docs.yaml" -const TestCase1DestMetaDataPathSuffix = "/Docs/docs.yaml" -const TestCase2PngPath = "testdata/TestArtifactDirectory/ArtifactSet2/icon.png" -const TestCase2DestPngPathSuffix = "/Image/icon.png" -const TestCase2JpegPath = "testdata/TestArtifactDirectory/ArtifactSet2/icon.jpeg" -const TestCase2DestJpegPathSuffix = "/Image/icon.jpeg" +const DevFirstUpdatedSampleCaseDocPath = "testdata/TestArtifactDirectory/DevFirstUpdatedSampleCaseArtifacts/testDoc.pdf" +const DevFirstUpdatedSampleCaseDestPathSuffix = "/Docs/FileContents/testDoc.pdf" +const DevFirstSampleCaseDocPath = "testdata/TestArtifactDirectory/DevFirstSampleCase/mockPdf.pdf" +const DevFirstSampleCaseDestPathSuffix = "/Docs/FileContents/mockPdf.pdf" +const DevFirstUpdatedSampleCaseDocMetaDataPath = "testdata/TestArtifactDirectory/DevFirstUpdatedSampleCaseArtifacts/docs.yaml" +const DevFirstUpdatedSampleCaseDestMetaDataPathSuffix = "/Docs/docs.yaml" +const DevFirstSampleCasePngPath = "testdata/TestArtifactDirectory/DevFirstSampleCase/icon.png" +const DevFirstSampleCasePngPathSuffix = "/Image/icon.png" +const DevFirstUpdatedSampleCaseJpegPath = "testdata/TestArtifactDirectory/DevFirstUpdatedSampleCaseArtifacts/icon.jpeg" +const DevFirstUpdatedSampleCaseDestJpegPathSuffix = "/Image/icon.jpeg" const TestDefaultExtractedFileName = "/SwaggerPetstoreNew-1.0.0" // APIEndpointParamsFile : Endpoint URL api_params.yaml