Skip to content

Commit f7daacd

Browse files
apply corrections from pull request feedbacks
1 parent 250a62d commit f7daacd

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

dataset/src/integrationTest/kotlin/com/cosmotech/dataset/service/DatasetServiceIntegrationTest.kt

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@ import io.mockk.impl.annotations.MockK
5454
import io.mockk.junit5.MockKExtension
5555
import io.mockk.mockk
5656
import io.mockk.mockkStatic
57-
import java.io.File
58-
import java.time.Instant
59-
import java.util.*
60-
import kotlin.test.assertEquals
61-
import kotlin.test.assertNotEquals
62-
import kotlin.test.assertTrue
6357
import kotlinx.coroutines.delay
6458
import kotlinx.coroutines.runBlocking
6559
import org.junit.jupiter.api.Assertions.assertFalse
@@ -84,6 +78,12 @@ import org.springframework.test.util.ReflectionTestUtils
8478
import org.springframework.web.context.request.RequestContextHolder
8579
import org.springframework.web.context.request.ServletRequestAttributes
8680
import redis.clients.jedis.JedisPool
81+
import java.io.File
82+
import java.time.Instant
83+
import java.util.*
84+
import kotlin.test.assertEquals
85+
import kotlin.test.assertNotEquals
86+
import kotlin.test.assertTrue
8787

8888
const val REDIS_PORT = 6379
8989
const val CONNECTED_ADMIN_USER = "[email protected]"
@@ -590,27 +590,29 @@ class DatasetServiceIntegrationTest : CsmRedisTestBase() {
590590
DatasetSourceType.Twincache to false,
591591
DatasetSourceType.File to true,
592592
DatasetSourceType.None to true)
593-
.map { (source, shouldThrow) ->
594-
DynamicTest.dynamicTest("Test RBAC refreshDataset : $source") {
593+
.map { (sourceType, shouldThrow) ->
594+
DynamicTest.dynamicTest("Test RBAC refreshDataset : $sourceType") {
595595
every { getCurrentAccountIdentifier(any()) } returns CONNECTED_ADMIN_USER
596596
organizationSaved =
597597
organizationApiService.registerOrganization(makeOrganization("organization"))
598598
val parentDataset =
599599
datasetApiService.createDataset(
600-
organizationSaved.id!!, makeDatasetWithRole(sourceType = source))
600+
organizationSaved.id!!, makeDatasetWithRole(sourceType = sourceType))
601601
datasetSaved =
602602
datasetApiService.createDataset(
603603
organizationSaved.id!!,
604-
makeDatasetWithRole(parentId = parentDataset.id!!, sourceType = source))
604+
makeDatasetWithRole(parentId = parentDataset.id!!, sourceType = sourceType))
605605

606606
every { eventPublisher.publishEvent(any<TwingraphImportEvent>()) } answers
607607
{
608608
firstArg<TwingraphImportEvent>().response = null
609609
}
610610
if (shouldThrow) {
611-
assertThrows<CsmResourceNotFoundException> {
612-
datasetApiService.refreshDataset(organizationSaved.id!!, datasetSaved.id!!)
613-
}
611+
val exception =
612+
assertThrows<CsmResourceNotFoundException> {
613+
datasetApiService.refreshDataset(organizationSaved.id!!, datasetSaved.id!!)
614+
}
615+
assertEquals("Cannot be applied to source type '$sourceType'", exception.message)
614616
} else {
615617
assertDoesNotThrow {
616618
datasetApiService.refreshDataset(organizationSaved.id!!, datasetSaved.id!!)

0 commit comments

Comments
 (0)