diff --git a/pom.xml b/pom.xml
index ddc3b84..0efdcfa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -54,6 +54,17 @@
io.quarkus
quarkus-rest-jackson
+
+
+ io.quarkus
+ quarkus-junit5
+ test
+
+
+ io.rest-assured
+ rest-assured
+ test
+
diff --git a/src/test/java/eu/m724/TokenTest.java b/src/test/java/eu/m724/TokenTest.java
new file mode 100644
index 0000000..daf11d3
--- /dev/null
+++ b/src/test/java/eu/m724/TokenTest.java
@@ -0,0 +1,50 @@
+package eu.m724;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.path.json.JsonPath;
+import jakarta.json.Json;
+import org.apache.http.HttpStatus;
+import org.junit.jupiter.api.Test;
+
+import static io.restassured.RestAssured.get;
+import static io.restassured.RestAssured.given;
+
+@QuarkusTest
+public class TokenTest {
+ @Test
+ void anonymousAccessTest() {
+ get("/api/tokens/me").then().statusCode(HttpStatus.SC_UNAUTHORIZED);
+ get("/api/tokens/create").then().statusCode(HttpStatus.SC_UNAUTHORIZED);
+ }
+
+ @Test
+ void createTokenTest() {
+ String tokenEncoded = given()
+ .header("X-Token", "AAAAAAAAAAAAAAAAAAAAAAAA")
+ .body(Json.createObjectBuilder().add("accessLimits", "kilo").build().toString())
+ .when()
+ .get("/api/tokens/create")
+ .then()
+ .statusCode(HttpStatus.SC_OK)
+ .extract().jsonPath().getString("token");
+
+ System.out.println("New token: " + tokenEncoded);
+
+ given()
+ .header("X-Token", tokenEncoded)
+ .when()
+ .get("/api/tokens/create")
+ .then()
+ .statusCode(HttpStatus.SC_FORBIDDEN);
+
+ JsonPath response = given()
+ .header("X-Token", tokenEncoded)
+ .when()
+ .get("/api/tokens/me")
+ .then()
+ .statusCode(HttpStatus.SC_OK)
+ .extract().jsonPath();
+
+ System.out.println(response.toString());
+ }
+}