-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into wip/add-deprecation-to-release-please
- Loading branch information
Showing
26 changed files
with
4,842 additions
and
3,560 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
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
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
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
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 |
---|---|---|
|
@@ -8,6 +8,8 @@ package org.knora.webapi | |
import zio._ | ||
import zio.http._ | ||
import zio.json._ | ||
import zio.json.ast.Json | ||
import zio.json.ast.JsonCursor | ||
import zio.test._ | ||
|
||
import org.knora.webapi.core.AppServer | ||
|
@@ -49,7 +51,7 @@ abstract class E2EZSpec extends ZIOSpecDefault with TestStartupUtils { | |
urlFull <- ZIO.fromEither(URL.decode(urlStr)).orDie | ||
_ <- ZIO.logDebug(s"GET ${urlFull.encode}") | ||
bearer = token.map(Header.Authorization.Bearer(_)).toList | ||
response <- client.url(urlFull).addHeaders(Headers(bearer)).get("/").orDie | ||
response <- client.url(urlFull).addHeaders(Headers(bearer)).get("").orDie | ||
} yield response | ||
|
||
def sendGetRequestStringOrFail(url: String, token: Option[String] = None): ZIO[env, String, String] = | ||
|
@@ -106,4 +108,18 @@ abstract class E2EZSpec extends ZIOSpecDefault with TestStartupUtils { | |
token <- ZIO.fromOption(result.get("token")).orElseFail("No token in response") | ||
} yield token | ||
|
||
def getRootToken: ZIO[env, String, String] = | ||
getToken("[email protected]", "test") | ||
|
||
def urlEncode(s: String): String = java.net.URLEncoder.encode(s, "UTF-8") | ||
|
||
def getOntologyLastModificationDate(ontlogyIri: String): ZIO[env, String, String] = { | ||
val cursor = JsonCursor.field("knora-api:lastModificationDate").isObject.field("@value").isString | ||
for { | ||
responseStr <- sendGetRequestStringOrFail(s"/v2/ontologies/allentities/${urlEncode(ontlogyIri)}") | ||
responseAst <- ZIO.fromEither(responseStr.fromJson[Json]) | ||
lmd <- ZIO.fromEither(responseAst.get(cursor)) | ||
} yield lmd.value | ||
} | ||
|
||
} |
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
Oops, something went wrong.