diff --git a/src/test/scala/org/broadinstitute/dsde/agora/server/webservice/ApiServiceSpec.scala b/src/test/scala/org/broadinstitute/dsde/agora/server/webservice/ApiServiceSpec.scala index 4e257ff5..e744b34b 100644 --- a/src/test/scala/org/broadinstitute/dsde/agora/server/webservice/ApiServiceSpec.scala +++ b/src/test/scala/org/broadinstitute/dsde/agora/server/webservice/ApiServiceSpec.scala @@ -27,8 +27,8 @@ class ApiServiceSpec extends FlatSpec with Matchers with Directives with Scalate Get(ApiUtil.Methods.withLeadingSlash + "/" + namespace1 + "/" + name1 + "/" + insertedEntity.id.get) ~> methodsService.queryByNamespaceNameIdRoute ~> check { val rawResponse = responseAs[String] - val response = grater[AgoraEntity].fromJSONArray(rawResponse) - response === insertedEntity + val response = grater[AgoraEntity].fromJSONArray(rawResponse).head + assert(response === insertedEntity) } } @@ -36,10 +36,10 @@ class ApiServiceSpec extends FlatSpec with Matchers with Directives with Scalate agoraDao.insert(testEntity2) agoraDao.insert(testEntity3) agoraDao.insert(testEntity4) - Get(ApiUtil.Methods.withLeadingSlash + "?namespace=" + namespace1 + "&owner=" + owner1) ~> methodsService.queryRoute ~> check { + Get(ApiUtil.Methods.withLeadingSlash + "?namespace=" + namespace1 + "&name=" + name1) ~> methodsService.queryRoute ~> check { val rawResponse = responseAs[String] val response = grater[AgoraEntity].fromJSONArray(rawResponse) - response === Seq(testEntity1, testEntity2) + assert(response === Seq(testEntity1, testEntity4)) } } @@ -47,28 +47,28 @@ class ApiServiceSpec extends FlatSpec with Matchers with Directives with Scalate Post(ApiUtil.Methods.withLeadingSlash, marshal(testAddRequest)) ~> methodsService.postRoute ~> check { val rawResponse = responseAs[String] val response = grater[AgoraEntity].fromJSON(rawResponse) - response.namespace === namespace1 - response.name === name1 - response.synopsis === synopsis - response.documentation === documentation - response.owner === owner1 - response.payload === payload - response.id === 1 - response.createDate != null + assert(response.namespace.get === namespace1) + assert(response.name.get === name1) + assert(response.synopsis.get === synopsis) + assert(response.documentation.get === documentation) + assert(response.owner.get === owner1) + assert(response.payload.get === payload) + assert(response.id.get !== None) + assert(response.createDate.get != null) } } "Agora" should "return a 400 bad request when posting a malformed payload" in { Post(ApiUtil.Methods.withLeadingSlash, marshal(testBadAddRequest)) ~> methodsService.postRoute ~> check { - status === BadRequest - responseAs[String] != null + assert(status === BadRequest) + assert(responseAs[String] != null) } } "Agora" should "store 10kb of github markdown as method documentation and return it without alteration" in { - Post(ApiUtil.Methods.withLeadingSlash, marshal(testAddRequest)) ~> methodsService.postRoute ~> check { + Post(ApiUtil.Methods.withLeadingSlash, marshal(testAddRequestBigDoc)) ~> methodsService.postRoute ~> check { val rawResponse = responseAs[String] - grater[AgoraEntity].fromJSON(rawResponse).documentation === bigDocumentation + assert(grater[AgoraEntity].fromJSON(rawResponse).documentation.get === bigDocumentation) } } }