From 3a022a635123a5eeb646b484c62bfa18072c9bd2 Mon Sep 17 00:00:00 2001 From: Bastian Doetsch Date: Tue, 10 Oct 2023 09:56:12 +0200 Subject: [PATCH] fix: deep code api test --- src/test/kotlin/snyk/code/DeepCodeRestApiTest.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/test/kotlin/snyk/code/DeepCodeRestApiTest.kt b/src/test/kotlin/snyk/code/DeepCodeRestApiTest.kt index 4ed55f184..2c5af64c6 100644 --- a/src/test/kotlin/snyk/code/DeepCodeRestApiTest.kt +++ b/src/test/kotlin/snyk/code/DeepCodeRestApiTest.kt @@ -14,6 +14,7 @@ import ai.deepcode.javaclient.responses.CreateBundleResponse import ai.deepcode.javaclient.responses.EmptyResponse import ai.deepcode.javaclient.responses.GetAnalysisResponse import ai.deepcode.javaclient.responses.GetFiltersResponse +import ai.grazie.utils.mpp.UUID import io.mockk.every import io.mockk.mockk import io.mockk.mockkStatic @@ -35,7 +36,7 @@ import java.nio.file.Files import java.nio.file.Paths import java.security.MessageDigest import java.security.NoSuchAlgorithmException -import java.util.Objects +import java.util.* /* * This Java source file was generated by the Gradle 'init' task. @@ -61,6 +62,7 @@ class DeepCodeRestApiImplTest { fileContent[deepCodedPath] = FileHash2ContentRequest(getHash(fileText), fileText) return restApiClient!!.createBundle( orgName, + UUID.random().toString(), fileContent ) } @@ -107,6 +109,7 @@ class DeepCodeRestApiImplTest { val response: CreateBundleResponse = restApiClient!!.createBundle( loggedOrgName, + UUID.random().toString(), files ) Assert.assertNotNull(response) @@ -143,6 +146,7 @@ class DeepCodeRestApiImplTest { val checkBundleCreateBundleResponse: CreateBundleResponse = restApiClient!!.createBundle( loggedOrgName, + UUID.random().toString(), fileHashRequest ) Assert.assertNotNull(checkBundleCreateBundleResponse) @@ -159,6 +163,7 @@ class DeepCodeRestApiImplTest { val checkBundleResponse: CreateBundleResponse = restApiClient!!.checkBundle( loggedOrgName, + UUID.random().toString(), checkBundleCreateBundleResponse.bundleHash ) Assert.assertNotNull(checkBundleResponse) @@ -189,6 +194,7 @@ class DeepCodeRestApiImplTest { val checkBundleResponseNew: CreateBundleResponse = restApiClient!!.checkBundle( loggedOrgName, + UUID.random().toString(), checkBundleCreateBundleResponse.bundleHash ) Assert.assertNotNull(checkBundleResponseNew) @@ -247,6 +253,7 @@ class DeepCodeRestApiImplTest { val extendBundleResponse: CreateBundleResponse = restApiClient!!.extendBundle( loggedOrgName, + UUID.random().toString(), createBundleResponse.bundleHash, extendBundleWithHashRequest ) @@ -284,6 +291,7 @@ class DeepCodeRestApiImplTest { val ebr = ExtendBundleWithContentRequest(map, emptyList()) return restApiClient!!.extendBundle( loggedOrgName, + UUID.random().toString(), createBundleResponse.bundleHash, ebr ) @@ -295,6 +303,7 @@ class DeepCodeRestApiImplTest { val createBundleResponse: CreateBundleResponse = restApiClient!!.createBundle( loggedOrgName, + UUID.random().toString(), fileHashRequest ) Assert.assertNotNull(createBundleResponse) @@ -345,6 +354,7 @@ class DeepCodeRestApiImplTest { for (i in 0..119) { response = restApiClient!!.getAnalysis( loggedOrgName, + UUID.random().toString(), bundleId, severity, analysedFiles, @@ -383,7 +393,7 @@ class DeepCodeRestApiImplTest { restApiClient = deepCodeRestApi filtersAndAssert() - var bundleId = createBundleAndAssert() + val bundleId = createBundleAndAssert() getAnalysisAndAssert(bundleId!!) createBundleWithHashAndAssert()