Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
sahibamittal committed Sep 17, 2024
1 parent 6095d95 commit 6711c97
Showing 1 changed file with 1 addition and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ public void getVulnerabilitiesByComponentUuidTest() throws Exception {
"source": "INTERNAL",
"description": "Description 1",
"severity": "CRITICAL",
"cwe": {
"cweId": 123,
"name": "Write-what-where Condition"
},
"cwes": [
{
"cweId": 123,
Expand All @@ -95,10 +91,6 @@ public void getVulnerabilitiesByComponentUuidTest() throws Exception {
"source": "INTERNAL",
"description": "Description 2",
"severity": "HIGH",
"cwe": {
"cweId": 321,
"name": "Use of Hard-coded Cryptographic Key"
},
"cwes": [
{
"cweId": 321,
Expand Down Expand Up @@ -143,10 +135,6 @@ public void getVulnerabilitiesByComponentUuidIncludeSuppressedTest() {
"source": "INTERNAL",
"description": "Description 1",
"severity": "CRITICAL",
"cwe": {
"cweId": 123,
"name": "Write-what-where Condition"
},
"cwes": [
{
"cweId": 123,
Expand All @@ -163,10 +151,6 @@ public void getVulnerabilitiesByComponentUuidIncludeSuppressedTest() {
"source": "INTERNAL",
"description": "Description 2",
"severity": "HIGH",
"cwe": {
"cweId": 321,
"name": "Use of Hard-coded Cryptographic Key"
},
"cwes": [
{
"cweId": 321,
Expand Down Expand Up @@ -207,10 +191,6 @@ public void getVulnerabilitiesByProjectTest() throws Exception {
"source": "INTERNAL",
"description": "Description 1",
"severity": "CRITICAL",
"cwe": {
"cweId": 123,
"name": "Write-what-where Condition"
},
"cwes": [
{
"cweId": 123,
Expand Down Expand Up @@ -239,10 +219,6 @@ public void getVulnerabilitiesByProjectTest() throws Exception {
"source": "INTERNAL",
"description": "Description 2",
"severity": "HIGH",
"cwe": {
"cweId": 321,
"name": "Use of Hard-coded Cryptographic Key"
},
"cwes": [
{
"cweId": 321,
Expand Down Expand Up @@ -271,10 +247,6 @@ public void getVulnerabilitiesByProjectTest() throws Exception {
"source": "INTERNAL",
"description": "Description 4",
"severity": "LOW",
"cwe": {
"cweId": 123,
"name": "Write-what-where Condition"
},
"cwes": [
{
"cweId": 123,
Expand Down Expand Up @@ -345,10 +317,6 @@ public void getVulnerabilitiesByProjectIncludeProjectSuppressedTest() throws Exc
"source": "INTERNAL",
"description": "Description 4",
"severity": "LOW",
"cwe": {
"cweId": 123,
"name": "Write-what-where Condition"
},
"cwes": [
{
"cweId": 123,
Expand Down Expand Up @@ -650,8 +618,6 @@ public void createVulnerabilityTest() {
Assert.assertEquals(1.75, json.getJsonNumber("owaspRRBusinessImpactScore").doubleValue(), 0);
Assert.assertEquals("SL:1/M:1/O:0/S:2/ED:1/EE:1/A:1/ID:1/LC:2/LI:1/LAV:1/LAC:1/FD:1/RD:1/NC:2/PV:3", json.getString("owaspRRVector"));
Assert.assertEquals("MEDIUM", json.getString("severity"));
Assert.assertNotNull(json.getJsonObject("cwe"));
Assert.assertEquals(80, json.getJsonObject("cwe").getInt("cweId"));
Assert.assertEquals(1, json.getJsonArray("cwes").size());
Assert.assertEquals(80, json.getJsonArray("cwes").getJsonObject(0).getInt("cweId"));
Assert.assertEquals("Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)", json.getJsonArray("cwes").getJsonObject(0).getString("name"));
Expand Down Expand Up @@ -699,7 +665,7 @@ public void createVulnerabilityWithBadOwaspVectorTest() {
public void createVulnerabilityCwePreV450CompatTest() {
JsonObject payload = Json.createObjectBuilder()
.add("vulnId", "ACME-1")
.add("cwe", Json.createObjectBuilder().add("cweId", 80))
.add("cwes", Json.createArrayBuilder().add(Json.createObjectBuilder().add("cweId", 80)))
.build();
Response response = jersey.target(V1_VULNERABILITY).request()
.header(X_API_KEY, apiKey)
Expand All @@ -709,9 +675,6 @@ public void createVulnerabilityCwePreV450CompatTest() {
Assert.assertNotNull(json);
Assert.assertEquals("ACME-1", json.getString("vulnId"));
Assert.assertEquals("INTERNAL", json.getString("source"));
Assert.assertNotNull(json.getJsonObject("cwe"));
Assert.assertEquals(80, json.getJsonObject("cwe").getInt("cweId"));
Assert.assertEquals("Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)", json.getJsonObject("cwe").getString("name"));
Assert.assertEquals(1, json.getJsonArray("cwes").size());
Assert.assertEquals(80, json.getJsonArray("cwes").getJsonObject(0).getInt("cweId"));
Assert.assertEquals("Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)", json.getJsonArray("cwes").getJsonObject(0).getString("name"));
Expand Down

0 comments on commit 6711c97

Please sign in to comment.