@Test
fun `request with invalid post parameter results in fcp exception`() {
- parameters.putSingle("Post", "InvalidPostId")
+ parameters += "Post" to "InvalidPostId"
executeCommandAndExpectFcpException()
}
@Test
fun `request with post from remote sone returns error response`() {
- parameters.putSingle("Post", "RemotePostId")
- whenever(core.getPost("RemotePostId")).thenReturn(of(postFromRemoteSone))
- val response = command.execute(parameters, null, null)
+ parameters += "Post" to "RemotePostId"
+ whenever(core.getPost("RemotePostId")).thenReturn(postFromRemoteSone)
+ val response = command.execute(parameters)
assertThat(response.replyParameters["Message"], equalTo("Error"))
assertThat(response.replyParameters["ErrorCode"], equalTo("401"))
}
@Test
fun `request with post from local sone deletes posts`() {
- parameters.putSingle("Post", "LocalPostId")
- whenever(core.getPost("LocalPostId")).thenReturn(of(postFromLocalSone))
- val response = command.execute(parameters, null, null)
+ parameters += "Post" to "LocalPostId"
+ whenever(core.getPost("LocalPostId")).thenReturn(postFromLocalSone)
+ val response = command.execute(parameters)
assertThat(response.replyParameters["Message"], equalTo("PostDeleted"))
verify(core).deletePost(postFromLocalSone)
}