1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-18 04:01:42 +00:00

#180: last inbox sync infos

This commit is contained in:
Benjamin Gamard
2018-02-27 17:11:04 +01:00
parent 1054931e63
commit 062dee987f
4 changed files with 64 additions and 6 deletions

View File

@@ -249,6 +249,10 @@ public class TestAppResource extends BaseJerseyTest {
Assert.assertTrue(json.isNull("username"));
Assert.assertTrue(json.isNull("password"));
Assert.assertTrue(json.isNull("tag"));
JsonObject lastSync = json.getJsonObject("last_sync");
Assert.assertTrue(lastSync.isNull("date"));
Assert.assertTrue(lastSync.isNull("error"));
Assert.assertEquals(0, lastSync.getJsonNumber("count").intValue());
// Change inbox configuration
target().path("/app/config_inbox").request()
@@ -299,6 +303,15 @@ public class TestAppResource extends BaseJerseyTest {
.get(JsonObject.class);
Assert.assertEquals(1, json.getJsonArray("documents").size());
// Get inbox configuration
json = target().path("/app/config_inbox").request()
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, adminToken)
.get(JsonObject.class);
lastSync = json.getJsonObject("last_sync");
Assert.assertFalse(lastSync.isNull("date"));
Assert.assertTrue(lastSync.isNull("error"));
Assert.assertEquals(1, lastSync.getJsonNumber("count").intValue());
// Trigger an inbox sync
AppContext.getInstance().getInboxService().syncInbox();
@@ -310,6 +323,15 @@ public class TestAppResource extends BaseJerseyTest {
.get(JsonObject.class);
Assert.assertEquals(1, json.getJsonArray("documents").size());
// Get inbox configuration
json = target().path("/app/config_inbox").request()
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, adminToken)
.get(JsonObject.class);
lastSync = json.getJsonObject("last_sync");
Assert.assertFalse(lastSync.isNull("date"));
Assert.assertTrue(lastSync.isNull("error"));
Assert.assertEquals(0, lastSync.getJsonNumber("count").intValue());
greenMail.stop();
}
}