Skip to content

Commit

Permalink
test(vulnerable-code): Correct a stub path and assertion condition
Browse files Browse the repository at this point in the history
This is a fixup for 45b40d8. The test passed although the stub was not
matched because only the presence of an issue was checked, but not which
one. Improve that as well.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Nov 15, 2024
1 parent f23fbb2 commit ffda909
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import io.kotest.core.spec.style.WordSpec
import io.kotest.matchers.collections.beEmpty
import io.kotest.matchers.collections.containExactly
import io.kotest.matchers.collections.containExactlyInAnyOrder
import io.kotest.matchers.collections.shouldHaveSize
import io.kotest.matchers.collections.shouldBeSingleton
import io.kotest.matchers.maps.shouldNotBeEmpty
import io.kotest.matchers.nulls.shouldNotBeNull
import io.kotest.matchers.should
Expand Down Expand Up @@ -219,7 +219,7 @@ class VulnerableCodeTest : WordSpec({

"handle a failure response from the server" {
server.stubFor(
post(urlPathEqualTo("/api/packages/bulk_search/"))
post(urlPathEqualTo("/packages/bulk_search"))
.willReturn(
aResponse().withStatus(500)
)
Expand All @@ -236,8 +236,10 @@ class VulnerableCodeTest : WordSpec({
with(getValue(pkg)) {
advisor shouldBe vulnerableCode.details
vulnerabilities should beEmpty()
summary.issues shouldHaveSize 1
summary.issues.first().severity shouldBe Severity.ERROR
summary.issues.shouldBeSingleton { issue ->
issue.severity shouldBe Severity.ERROR
issue.message shouldBe "HttpException: HTTP 500 Server Error"
}
}
}
}
Expand Down

0 comments on commit ffda909

Please sign in to comment.