Skip to content

Commit ca36d08

Browse files
committed
Fix tests #33
1 parent 6ac8495 commit ca36d08

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/test/kotlin/io/openfuture/api/controller/api/EthereumScaffoldApiControllerTests.kt

+19-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class EthereumScaffoldApiControllerTests : ControllerTests() {
138138
val openKey = createOpenKey(setOf(Role("ROLE_MASTER")))
139139
val scaffold = createScaffold(openKey)
140140
val request = SaveEthereumScaffoldRequest("0x8cf1664B09F216538bc9A32B2c26f85a19fd76B5", "abi", "openKey",
141-
"0x8cf1664B09F216538bc9A32B2c26f85a19fd76B5", "description", "2", USD, "0.0023", "webHook",
141+
"0x8cf1664B09F216538bc9A32B2c26f85a19fd76B5", "description", "2", USD, "0.0023", "https://www.openfuture.io/api",
142142
listOf(createScaffoldPropertyDto()))
143143
val requestJson = objectMapper.writeValueAsString(request)
144144

@@ -154,6 +154,24 @@ class EthereumScaffoldApiControllerTests : ControllerTests() {
154154
.andExpect(content().json(expectScaffoldJson(scaffold), true))
155155
}
156156

157+
@Test
158+
fun saveShouldReturnBadRequestTest() {
159+
val openKey = createOpenKey(setOf(Role("ROLE_MASTER")))
160+
val request = SaveEthereumScaffoldRequest("0x8cf1664B09F216538bc9A32B2c26f85a19fd76B5", "abi", "openKey",
161+
"0x8cf1664B09F216538bc9A32B2c26f85a19fd76B5", "description", "2", USD, "0.0023", "invalid webhhok",
162+
listOf(createScaffoldPropertyDto()))
163+
val requestJson = objectMapper.writeValueAsString(request)
164+
165+
given(keyService.find(openKey.value)).willReturn(openKey)
166+
167+
mvc.perform(post("/api/ethereum-scaffolds")
168+
.header(AUTHORIZATION, openKey.value)
169+
.contentType(APPLICATION_JSON_UTF8)
170+
.content(requestJson))
171+
172+
.andExpect(status().isBadRequest)
173+
}
174+
157175
@Test
158176
fun updateTest() {
159177
val openKey = createOpenKey(setOf(Role("ROLE_MASTER")))

0 commit comments

Comments
 (0)