mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
add even more integration tests
This commit is contained in:
@@ -10,7 +10,6 @@ import java.util.Objects;
|
||||
|
||||
import jakarta.ws.rs.client.Client;
|
||||
import jakarta.ws.rs.core.HttpHeaders;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hc.core5.http.HttpStatus;
|
||||
@@ -29,6 +28,7 @@ import com.commafeed.frontend.model.request.AddCategoryRequest;
|
||||
import com.commafeed.frontend.model.request.SubscribeRequest;
|
||||
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.http.ContentType;
|
||||
import io.restassured.http.Header;
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -95,7 +95,7 @@ public abstract class BaseIT {
|
||||
addCategoryRequest.setName(name);
|
||||
return RestAssured.given()
|
||||
.body(addCategoryRequest)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.contentType(ContentType.JSON)
|
||||
.post("rest/category/add")
|
||||
.then()
|
||||
.extract()
|
||||
@@ -117,7 +117,7 @@ public abstract class BaseIT {
|
||||
subscribeRequest.setCategoryId(categoryId);
|
||||
return RestAssured.given()
|
||||
.body(subscribeRequest)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.contentType(ContentType.JSON)
|
||||
.post("rest/feed/subscribe")
|
||||
.then()
|
||||
.statusCode(HttpStatus.SC_OK)
|
||||
@@ -162,6 +162,24 @@ public abstract class BaseIT {
|
||||
.as(Entries.class);
|
||||
}
|
||||
|
||||
protected Entries getCategoryEntries(String categoryId, String keywords) {
|
||||
return RestAssured.given()
|
||||
.get("rest/category/entries?id={id}&readType=all&keywords={keywords}", categoryId, keywords)
|
||||
.then()
|
||||
.statusCode(HttpStatus.SC_OK)
|
||||
.extract()
|
||||
.as(Entries.class);
|
||||
}
|
||||
|
||||
protected Entries getTaggedEntries(String tag) {
|
||||
return RestAssured.given()
|
||||
.get("rest/category/entries?id=all&readType=all&tag={tag}", tag)
|
||||
.then()
|
||||
.statusCode(HttpStatus.SC_OK)
|
||||
.extract()
|
||||
.as(Entries.class);
|
||||
}
|
||||
|
||||
protected int forceRefreshAllFeeds() {
|
||||
return RestAssured.given().get("rest/feed/refreshAll").then().extract().statusCode();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user