-
Notifications
You must be signed in to change notification settings - Fork 640
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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") | ||
} | ||
|
@@ -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) | ||
} | ||
|