Skip to content

Commit

Permalink
Revert "Remove test"
Browse files Browse the repository at this point in the history
This reverts commit 5763c1b.
  • Loading branch information
olivergrabinski committed Apr 15, 2024
1 parent 5763c1b commit 2f677a8
Showing 1 changed file with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,29 @@ class ShipIntegrationSpec extends BaseIntegrationSpec {
thereShouldBeAView(project, bgView, bgViewJson)
}

"transfer a search view" in {
val (project, _, _) = thereIsAProject()
val (searchView, searchViewJson) = thereIsASearchView(project)

whenTheExportIsRunOnProject(project)
theOldProjectIsDeleted(project)

weRunTheImporter(project)
weFixThePermissions(project)

thereShouldBeAViewIgnoringUUID(project, searchView, searchViewJson)
}

def thereIsASearchView(project: ProjectRef): (Iri, Json) = {
val searchView = nxv + "searchView"
val encodedView = UrlUtils.encode(searchView.toString)
val (viewJson, status) = deltaClient
.getJsonAndStatus(s"/views/${project.organization}/${project.project}/$encodedView", writer)
.accepted
status shouldEqual StatusCodes.OK
searchView -> viewJson
}

def thereShouldBeAView(project: ProjectRef, view: Iri, originalJson: Json): Assertion = {
val encodedIri = UrlUtils.encode(view.toString)
deltaClient
Expand All @@ -151,6 +174,28 @@ class ShipIntegrationSpec extends BaseIntegrationSpec {
.accepted
}

def thereShouldBeAViewIgnoringUUID(project: ProjectRef, view: Iri, originalJson: Json): Assertion = {
val encodedIri = UrlUtils.encode(view.toString)

import io.circe.optics.JsonPath.root
val ignoreSourceUUID = root.sources.each.at("_uuid").replace(None)
val ignoreProjectionUUID = root.projections.each.at("_uuid").replace(None)
val ignoreUUID = root.at("_uuid").replace(None)

val filter = ignoreUUID andThen ignoreSourceUUID andThen ignoreProjectionUUID

root.sources.`null`

deltaClient
.get[Json](s"/views/${project.organization}/${project.project}/$encodedIri", writer) { (json, response) =>
{
response.status shouldEqual StatusCodes.OK
filter(json) shouldEqual filter(originalJson)
}
}
.accepted
}

def thereIsABlazegraphView(project: ProjectRef): (Iri, Json) = {
val simpleBgView = json"""{
"@type": "SparqlView",
Expand Down

0 comments on commit 2f677a8

Please sign in to comment.