Skip to content

Commit

Permalink
fix: deep code api test
Browse files Browse the repository at this point in the history
  • Loading branch information
bastiandoetsch committed Oct 10, 2023
1 parent e6461a7 commit 3a022a6
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/test/kotlin/snyk/code/DeepCodeRestApiTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -61,6 +62,7 @@ class DeepCodeRestApiImplTest {
fileContent[deepCodedPath] = FileHash2ContentRequest(getHash(fileText), fileText)
return restApiClient!!.createBundle(
orgName,
UUID.random().toString(),
fileContent
)
}
Expand Down Expand Up @@ -107,6 +109,7 @@ class DeepCodeRestApiImplTest {
val response: CreateBundleResponse =
restApiClient!!.createBundle(
loggedOrgName,
UUID.random().toString(),
files
)
Assert.assertNotNull(response)
Expand Down Expand Up @@ -143,6 +146,7 @@ class DeepCodeRestApiImplTest {
val checkBundleCreateBundleResponse: CreateBundleResponse =
restApiClient!!.createBundle(
loggedOrgName,
UUID.random().toString(),
fileHashRequest
)
Assert.assertNotNull(checkBundleCreateBundleResponse)
Expand All @@ -159,6 +163,7 @@ class DeepCodeRestApiImplTest {
val checkBundleResponse: CreateBundleResponse =
restApiClient!!.checkBundle(
loggedOrgName,
UUID.random().toString(),
checkBundleCreateBundleResponse.bundleHash
)
Assert.assertNotNull(checkBundleResponse)
Expand Down Expand Up @@ -189,6 +194,7 @@ class DeepCodeRestApiImplTest {
val checkBundleResponseNew: CreateBundleResponse =
restApiClient!!.checkBundle(
loggedOrgName,
UUID.random().toString(),
checkBundleCreateBundleResponse.bundleHash
)
Assert.assertNotNull(checkBundleResponseNew)
Expand Down Expand Up @@ -247,6 +253,7 @@ class DeepCodeRestApiImplTest {
val extendBundleResponse: CreateBundleResponse =
restApiClient!!.extendBundle<ExtendBundleWithHashRequest>(
loggedOrgName,
UUID.random().toString(),
createBundleResponse.bundleHash,
extendBundleWithHashRequest
)
Expand Down Expand Up @@ -284,6 +291,7 @@ class DeepCodeRestApiImplTest {
val ebr = ExtendBundleWithContentRequest(map, emptyList())
return restApiClient!!.extendBundle<ExtendBundleWithContentRequest>(
loggedOrgName,
UUID.random().toString(),
createBundleResponse.bundleHash,
ebr
)
Expand All @@ -295,6 +303,7 @@ class DeepCodeRestApiImplTest {
val createBundleResponse: CreateBundleResponse =
restApiClient!!.createBundle(
loggedOrgName,
UUID.random().toString(),
fileHashRequest
)
Assert.assertNotNull(createBundleResponse)
Expand Down Expand Up @@ -345,6 +354,7 @@ class DeepCodeRestApiImplTest {
for (i in 0..119) {
response = restApiClient!!.getAnalysis(
loggedOrgName,
UUID.random().toString(),
bundleId,
severity,
analysedFiles,
Expand Down Expand Up @@ -383,7 +393,7 @@ class DeepCodeRestApiImplTest {

restApiClient = deepCodeRestApi
filtersAndAssert()
var bundleId = createBundleAndAssert()
val bundleId = createBundleAndAssert()
getAnalysisAndAssert(bundleId!!)

createBundleWithHashAndAssert()
Expand Down

0 comments on commit 3a022a6

Please sign in to comment.