mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
websocket notification now takes entry filtering into account (#1191)
This commit is contained in:
@@ -38,6 +38,8 @@ import lombok.Getter;
|
||||
@ExtendWith(MockServerExtension.class)
|
||||
public abstract class BaseIT {
|
||||
|
||||
private static final HttpRequest FEED_REQUEST = HttpRequest.request().withMethod("GET").withPath("/");
|
||||
|
||||
private final CommaFeedDropwizardAppExtension extension = buildExtension();
|
||||
|
||||
private Client client;
|
||||
@@ -50,6 +52,8 @@ public abstract class BaseIT {
|
||||
|
||||
private String webSocketUrl;
|
||||
|
||||
private MockServerClient mockServerClient;
|
||||
|
||||
protected CommaFeedDropwizardAppExtension buildExtension() {
|
||||
return new CommaFeedDropwizardAppExtension() {
|
||||
@Override
|
||||
@@ -61,9 +65,10 @@ public abstract class BaseIT {
|
||||
|
||||
@BeforeEach
|
||||
void init(MockServerClient mockServerClient) throws IOException {
|
||||
this.mockServerClient = mockServerClient;
|
||||
|
||||
URL resource = Objects.requireNonNull(getClass().getResource("/feed/rss.xml"));
|
||||
mockServerClient.when(HttpRequest.request().withMethod("GET").withPath("/"))
|
||||
.respond(HttpResponse.response().withBody(IOUtils.toString(resource, StandardCharsets.UTF_8)));
|
||||
mockServerClient.when(FEED_REQUEST).respond(HttpResponse.response().withBody(IOUtils.toString(resource, StandardCharsets.UTF_8)));
|
||||
|
||||
this.client = extension.client();
|
||||
this.feedUrl = "http://localhost:" + mockServerClient.getPort() + "/";
|
||||
@@ -77,6 +82,13 @@ public abstract class BaseIT {
|
||||
this.client.close();
|
||||
}
|
||||
|
||||
protected void feedNowReturnsMoreEntries() throws IOException {
|
||||
mockServerClient.clear(FEED_REQUEST);
|
||||
|
||||
URL resource = Objects.requireNonNull(getClass().getResource("/feed/rss_2.xml"));
|
||||
mockServerClient.when(FEED_REQUEST).respond(HttpResponse.response().withBody(IOUtils.toString(resource, StandardCharsets.UTF_8)));
|
||||
}
|
||||
|
||||
protected String login() {
|
||||
LoginRequest req = new LoginRequest();
|
||||
req.setName("admin");
|
||||
@@ -112,4 +124,8 @@ public abstract class BaseIT {
|
||||
.get();
|
||||
return response.readEntity(Entries.class);
|
||||
}
|
||||
|
||||
protected void forceRefreshAllFeeds() {
|
||||
client.target(apiBaseUrl + "feed/refreshAll").request().get(Void.class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user