Skip to content

Commit 4305e52

Browse files
authored
Merge pull request #459 from modelix/test/delete-repository-endpoint
Improve testing of the deleteRepository endpoint
2 parents 6c4a79a + 4d9f7a7 commit 4305e52

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

model-server/src/main/kotlin/org/modelix/model/server/handlers/RepositoriesManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class RepositoriesManager(val client: LocalModelClient) {
8585
}
8686
}
8787

88-
fun repositoryExists(repositoryId: RepositoryId) = getRepositories().contains(repositoryId)
88+
private fun repositoryExists(repositoryId: RepositoryId) = getRepositories().contains(repositoryId)
8989

9090
fun createRepository(repositoryId: RepositoryId, userName: String?, useRoleIds: Boolean = true): CLVersion {
9191
var initialVersion: CLVersion? = null

model-server/src/test/kotlin/org/modelix/model/server/ModelClientV2Test.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ import org.modelix.modelql.untyped.allChildren
3939
import java.util.UUID
4040
import kotlin.test.Test
4141
import kotlin.test.assertEquals
42+
import kotlin.test.assertFalse
43+
import kotlin.test.assertTrue
4244

4345
class ModelClientV2Test {
4446

@@ -164,8 +166,10 @@ class ModelClientV2Test {
164166
client.initRepository(repositoryId)
165167

166168
val success = client.deleteRepository(repositoryId)
169+
val containsRepository = client.listRepositories().contains(repositoryId)
167170

168-
assertEquals(true, success)
171+
assertTrue(success)
172+
assertFalse(containsRepository)
169173
}
170174

171175
@Test
@@ -175,7 +179,9 @@ class ModelClientV2Test {
175179
val repositoryId = RepositoryId(UUID.randomUUID().toString())
176180

177181
val success = client.deleteRepository(repositoryId)
182+
val containsRepository = client.listRepositories().contains(repositoryId)
178183

179-
assertEquals(false, success)
184+
assertFalse(success)
185+
assertFalse(containsRepository)
180186
}
181187
}

0 commit comments

Comments
 (0)