Skip to content

Commit

Permalink
#1395 Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Jun 29, 2020
1 parent 3416052 commit 39bee65
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ class OrganisationCtrlTest extends PlaySpecification with TestAppBuilder {
status(result) must beEqualTo(201).updateMessage(s => s"$s\n${contentAsString(result)}")
contentAsJson(result).as[OutputOrganisation].name must_=== "orga1"

val requestBulkLink = FakeRequest("PUT", s"/api/organisation/admin/links")
val requestBulkLink = FakeRequest("PUT", s"/api/organisation/cert/links")
.withHeaders("user" -> "[email protected]")
.withJsonBody(Json.parse("""{"organisations":["orga1"]}"""))
val resultBulkLink = app[OrganisationCtrl].bulkLink("admin")(requestBulkLink)
val resultBulkLink = app[OrganisationCtrl].bulkLink("cert")(requestBulkLink)
status(resultBulkLink) must beEqualTo(201).updateMessage(s => s"$s\n${contentAsString(resultBulkLink)}")

val requestLinks = FakeRequest("GET", s"/api/organisation/admin/links")
val requestLinks = FakeRequest("GET", s"/api/organisation/cert/links")
.withHeaders("user" -> "[email protected]")
val resultLinks = app[OrganisationCtrl].listLinks("admin")(requestLinks)
val resultLinks = app[OrganisationCtrl].listLinks("cert")(requestLinks)
status(resultLinks) must beEqualTo(200).updateMessage(s => s"$s\n${contentAsString(resultLinks)}")
contentAsJson(resultLinks).as[List[OutputOrganisation]].map(_.name) must contain("orga1")
}
Expand Down Expand Up @@ -76,15 +76,15 @@ class OrganisationCtrlTest extends PlaySpecification with TestAppBuilder {
status(result) must_=== 204
}

"link organisations to admin organisation" in testApp { app =>
val request = FakeRequest("PUT", s"/api/organisation/admin/link/cert")
"link organisations to soc organisation" in testApp { app =>
val request = FakeRequest("PUT", s"/api/organisation/soc/link/cert")
.withHeaders("user" -> "[email protected]")
val result = app[OrganisationCtrl].link("admin", "cert")(request)
val result = app[OrganisationCtrl].link("soc", "cert")(request)
status(result) shouldEqual 201

val requestLinks = FakeRequest("GET", s"/api/organisation/admin/links")
val requestLinks = FakeRequest("GET", s"/api/organisation/soc/links")
.withHeaders("user" -> "[email protected]")
val resultLinks = app[OrganisationCtrl].listLinks("admin")(requestLinks)
val resultLinks = app[OrganisationCtrl].listLinks("soc")(requestLinks)
status(resultLinks) shouldEqual 200
contentAsJson(resultLinks).as[List[OutputOrganisation]] must not(beEmpty)
}
Expand Down

0 comments on commit 39bee65

Please sign in to comment.