-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sumanth K B
committed
Sep 22, 2023
1 parent
cc1efe8
commit b35f084
Showing
2 changed files
with
309 additions
and
0 deletions.
There are no files selected for viewing
252 changes: 252 additions & 0 deletions
252
TestFiles/IntegrationTestFiles/ArtifactoryUploaderTestData/PythonComparisonBOM.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,252 @@ | ||
{ | ||
"BomFormat": "CycloneDX", | ||
"SpecVersion": 4, | ||
"SpecVersionString": "1.4", | ||
"SerialNumber": null, | ||
"Version": null, | ||
"Metadata": { | ||
"Tools": [ | ||
{ | ||
"Vendor": "Siemens AG", | ||
"Name": "Clearing Automation Tool", | ||
"Version": "3.1.0", | ||
"Hashes": null | ||
} | ||
], | ||
"Authors": null, | ||
"Component": null, | ||
"Manufacture": null, | ||
"Supplier": null | ||
}, | ||
"Components": [ | ||
{ | ||
"Type": 0, | ||
"MimeType": null, | ||
"BomRef": "pkg:pypi/[email protected]", | ||
"Supplier": null, | ||
"Author": null, | ||
"Publisher": null, | ||
"Group": null, | ||
"Name": "html5lib", | ||
"Version": "1.1", | ||
"Description": "", | ||
"Scope": null, | ||
"Hashes": null, | ||
"Licenses": null, | ||
"Copyright": null, | ||
"Cpe": null, | ||
"Purl": "pkg:pypi/[email protected]", | ||
"Swid": null, | ||
"Modified": null, | ||
"Pedigree": null, | ||
"Components": null, | ||
"Properties": [ | ||
{ | ||
"Name": "internal:siemens:clearing:development", | ||
"Value": "false" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:identifier-type", | ||
"Value": "ManuallyAdded" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:is-internal", | ||
"Value": "false" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:repo-url", | ||
"Value": "org1-pythonhosted-pypi-remote-cache" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:project-type", | ||
"Value": "PYTHON" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:clearing-state", | ||
"Value": "Approved" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:sw360:release-url", | ||
"Value": "http://md2pdvnc.ad001.siemens.net:8095/resource/api/releases/f697515c180646c3b8b9b70ce6f2a2d8" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:fossology:url", | ||
"Value": null | ||
} | ||
], | ||
"Evidence": null | ||
}, | ||
{ | ||
"Type": 0, | ||
"MimeType": null, | ||
"BomRef": "pkg:pypi/[email protected]", | ||
"Supplier": null, | ||
"Author": null, | ||
"Publisher": null, | ||
"Group": null, | ||
"Name": "attrs", | ||
"Version": "22.1.0", | ||
"Description": "", | ||
"Scope": null, | ||
"Hashes": null, | ||
"Licenses": null, | ||
"Copyright": null, | ||
"Cpe": null, | ||
"Purl": "pkg:pypi/[email protected]", | ||
"Swid": null, | ||
"Modified": null, | ||
"Pedigree": null, | ||
"Components": null, | ||
"Properties": [ | ||
{ | ||
"Name": "internal:siemens:clearing:development", | ||
"Value": "false" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:identifier-type", | ||
"Value": "ManuallyAdded" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:is-internal", | ||
"Value": "false" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:repo-url", | ||
"Value": "Not Found in JFrogRepo" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:project-type", | ||
"Value": "PYTHON" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:clearing-state", | ||
"Value": "Approved" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:sw360:release-url", | ||
"Value": "http://md2pdvnc.ad001.siemens.net:8095/resource/api/releases/37fcf2d0725a46b8b777c849111e9be4" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:fossology:url", | ||
"Value": null | ||
} | ||
], | ||
"Evidence": null | ||
}, | ||
{ | ||
"Type": 0, | ||
"MimeType": null, | ||
"BomRef": "pkg:pypi/[email protected]", | ||
"Supplier": null, | ||
"Author": null, | ||
"Publisher": null, | ||
"Group": null, | ||
"Name": "beautifulsoup4", | ||
"Version": "4.11.1", | ||
"Description": "", | ||
"Scope": null, | ||
"Hashes": null, | ||
"Licenses": null, | ||
"Copyright": null, | ||
"Cpe": null, | ||
"Purl": "pkg:pypi/[email protected]", | ||
"Swid": null, | ||
"Modified": null, | ||
"Pedigree": null, | ||
"Components": null, | ||
"Properties": [ | ||
{ | ||
"Name": "internal:siemens:clearing:development", | ||
"Value": "false" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:identifier-type", | ||
"Value": "ManuallyAdded" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:is-internal", | ||
"Value": "false" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:repo-url", | ||
"Value": "org1-pythonhosted-pypi-remote-cache" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:project-type", | ||
"Value": "PYTHON" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:clearing-state", | ||
"Value": "Approved" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:sw360:release-url", | ||
"Value": "http://md2pdvnc.ad001.siemens.net:8095/resource/api/releases/4b92d5ac32f84d43a82f2c2c57771e6d" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:fossology:url", | ||
"Value": null | ||
} | ||
], | ||
"Evidence": null | ||
}, | ||
{ | ||
"Type": 0, | ||
"MimeType": null, | ||
"BomRef": "pkg:pypi/[email protected]", | ||
"Supplier": null, | ||
"Author": null, | ||
"Publisher": null, | ||
"Group": null, | ||
"Name": "cachy", | ||
"Version": "0.3.0", | ||
"Description": "", | ||
"Scope": null, | ||
"Hashes": null, | ||
"Licenses": null, | ||
"Copyright": null, | ||
"Cpe": null, | ||
"Purl": "pkg:pypi/[email protected]", | ||
"Swid": null, | ||
"Modified": null, | ||
"Pedigree": null, | ||
"Components": null, | ||
"Properties": [ | ||
{ | ||
"Name": "internal:siemens:clearing:development", | ||
"Value": "false" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:identifier-type", | ||
"Value": "ManuallyAdded" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:is-internal", | ||
"Value": "false" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:repo-url", | ||
"Value": "org1-pythonhosted-pypi-remote-cache" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:project-type", | ||
"Value": "PYTHON" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:clearing-state", | ||
"Value": "Approved" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:sw360:release-url", | ||
"Value": "http://md2pdvnc.ad001.siemens.net:8095/resource/api/releases/cece81ace4b14374af2432067bca5fb2" | ||
}, | ||
{ | ||
"Name": "internal:siemens:clearing:fossology:url", | ||
"Value": null | ||
} | ||
], | ||
"Evidence": null | ||
} | ||
], | ||
"Compositions": null | ||
} |
57 changes: 57 additions & 0 deletions
57
src/SW360IntegrationTest/Python/ArtifactoryUploaderPython.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright company="Siemens AG"> | ||
// Copyright (C) Siemens AG 2023. All rights reserved. | ||
// </copyright> | ||
//<license>MIT</license> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
using CycloneDX.Models; | ||
using NUnit.Framework; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Net.Http; | ||
using TestUtilities; | ||
|
||
namespace SW360IntegrationTest.Python | ||
{ | ||
[TestFixture, Order(25)] | ||
public class ArtifactoryUploaderPython | ||
{ | ||
private string OutFolder { get; set; } | ||
private static readonly TestParam testParameters = new TestParam(); | ||
[Test, Order(1)] | ||
public void TestArtifactoryUploaderexe() | ||
{ | ||
OutFolder = TestHelper.OutFolder; | ||
string comparisonBOMPath = OutFolder + @"\..\..\TestFiles\IntegrationTestFiles\ArtifactoryUploaderTestData\PythonComparisonBOM.json"; | ||
|
||
int result = TestHelper.RunArtifactoryUploaderExe(new string[]{ | ||
TestConstant.BomFilePath, comparisonBOMPath, | ||
TestConstant.ArtifactoryUser, testParameters.ArtifactoryUploadUser, | ||
TestConstant.ArtifactoryKey, testParameters.ArtifactoryUploadApiKey, | ||
TestConstant.JfrogNPMDestRepoName,testParameters.DestinationRepoName, | ||
TestConstant.JFrogApiURL,testParameters.JfrogApi | ||
}); | ||
|
||
// Test BOM Creator ran with exit code 0 or 2 (Warning) | ||
Assert.IsTrue(result == 0 || result == 2, | ||
"Test to run Artifactory Uploader EXE execution"); | ||
} | ||
|
||
[Test, Order(2)] | ||
public void ComponentUpload_IsFailure() | ||
{ | ||
HttpClient httpClient = new HttpClient(); | ||
httpClient.DefaultRequestHeaders.Add(TestConstant.JFrog_API_Header, testParameters.ArtifactoryUploadApiKey); | ||
httpClient.DefaultRequestHeaders.Add(TestConstant.Email, testParameters.ArtifactoryUploadUser); | ||
|
||
// Act | ||
string url = $"{TestConstant.JfrogApi}/pypi-test/cachy222-0.3.0-py2.py3-none-any.whl"; | ||
HttpResponseMessage responseBody = httpClient.GetAsync(url).Result; | ||
|
||
// Assert | ||
Assert.That(HttpStatusCode.NotFound, Is.EqualTo(responseBody.StatusCode), "Returns Failure status code"); | ||
} | ||
} | ||
} |