Skip to content

Commit ba62041

Browse files
committed
test(osv): Update expected resuts
Signed-off-by: Frank Viernau <[email protected]>
1 parent 8c600ce commit ba62041

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

clients/osv/src/funTest/assets/vulnerabilities-by-commit-expected-result.json

+1
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@
730730
"ALSA-2023:4159",
731731
"ALSA-2023:4175",
732732
"ALSA-2023:4177",
733+
"ALSA-2024:2410",
733734
"USN-6263-1"
734735
],
735736
"details": "hb-ot-layout-gsubgpos.hh in HarfBuzz through 6.0.0 allows attackers to trigger O(n^2) growth via consecutive marks during the process of looking back for base glyphs when attaching marks.",

clients/osv/src/funTest/kotlin/OsvServiceFunTest.kt

+4
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ import io.kotest.matchers.result.shouldBeSuccess
2525
import io.kotest.matchers.shouldBe
2626

2727
import java.time.Instant
28+
import kotlinx.serialization.encodeToString
2829

2930
import kotlinx.serialization.json.JsonObject
3031

3132
import org.ossreviewtoolkit.utils.test.getAssetAsString
33+
import org.ossreviewtoolkit.utils.test.getAssetFile
3234

3335
private val VULNERABILITY_FOR_PACKAGE_BY_COMMIT_REQUEST = VulnerabilitiesForPackageRequest(
3436
commit = "6879efc2c1596d11a6a6ad296f80063b558d5e0f"
@@ -68,6 +70,8 @@ class OsvServiceFunTest : StringSpec({
6870

6971
val result = OsvService().getVulnerabilitiesForPackage(VULNERABILITY_FOR_PACKAGE_BY_COMMIT_REQUEST)
7072

73+
getAssetFile("vulnerabilities-by-commit-expected-result.json").writeText(OsvApiClient.JSON.encodeToString(result.getOrNull()!!))
74+
7175
result.shouldBeSuccess { actualData ->
7276
val expectedData = OsvApiClient.JSON.decodeFromString<List<Vulnerability>>(expectedResult)
7377
actualData.patchFields() shouldContainExactlyInAnyOrder expectedData.patchFields()

clients/osv/src/main/kotlin/OsvApiClient.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ interface OsvApiClient {
4747
companion object {
4848
const val BATCH_REQUEST_MAX_SIZE = 1000
4949

50-
val JSON = Json { namingStrategy = JsonNamingStrategy.SnakeCase }
50+
val JSON = Json { prettyPrint = true; namingStrategy = JsonNamingStrategy.SnakeCase }
5151

5252
/**
5353
* Create an OsvApiClient instance for communicating with the given [server], optionally using a pre-built

0 commit comments

Comments
 (0)