-
-
Notifications
You must be signed in to change notification settings - Fork 497
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed remaining non-idempotent tests (#758)
- Loading branch information
Showing
10 changed files
with
104 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,10 @@ public class TestAppResource extends BaseJerseyTest { | |
* Test the API resource. | ||
*/ | ||
|
||
// Record if config has been changed by previous test runs | ||
private static boolean configInboxChanged = false; | ||
private static boolean configSmtpChanged = false; | ||
private static boolean configLdapChanged = false; | ||
|
||
@Test | ||
public void testAppResource() { | ||
|
@@ -191,6 +194,12 @@ public void testGuestLogin() { | |
target().path("/document/list").request() | ||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, guestToken) | ||
.get(JsonObject.class); | ||
|
||
// Disable guest login (clean up state) | ||
target().path("/app/guest_login").request() | ||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, adminToken) | ||
.post(Entity.form(new Form() | ||
.param("enabled", "false")), JsonObject.class); | ||
} | ||
|
||
/** | ||
|
@@ -205,11 +214,13 @@ public void testSmtpConfiguration() { | |
JsonObject json = target().path("/app/config_smtp").request() | ||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, adminToken) | ||
.get(JsonObject.class); | ||
Assert.assertTrue(json.isNull("hostname")); | ||
Assert.assertTrue(json.isNull("port")); | ||
Assert.assertTrue(json.isNull("username")); | ||
Assert.assertTrue(json.isNull("password")); | ||
Assert.assertTrue(json.isNull("from")); | ||
if (!configSmtpChanged) { | ||
Assert.assertTrue(json.isNull("hostname")); | ||
Assert.assertTrue(json.isNull("port")); | ||
Assert.assertTrue(json.isNull("username")); | ||
Assert.assertTrue(json.isNull("password")); | ||
Assert.assertTrue(json.isNull("from")); | ||
} | ||
|
||
// Change SMTP configuration | ||
target().path("/app/config_smtp").request() | ||
|
@@ -220,6 +231,7 @@ public void testSmtpConfiguration() { | |
.param("username", "sismics") | ||
.param("from", "[email protected]") | ||
), JsonObject.class); | ||
configSmtpChanged = true; | ||
|
||
// Get SMTP configuration | ||
json = target().path("/app/config_smtp").request() | ||
|
@@ -389,7 +401,9 @@ public void testLdapAuthentication() throws Exception { | |
JsonObject json = target().path("/app/config_ldap").request() | ||
.cookie(TokenBasedSecurityFilter.COOKIE_NAME, adminToken) | ||
.get(JsonObject.class); | ||
Assert.assertFalse(json.getBoolean("enabled")); | ||
if (!configLdapChanged) { | ||
Assert.assertFalse(json.getBoolean("enabled")); | ||
} | ||
|
||
// Change LDAP configuration | ||
target().path("/app/config_ldap").request() | ||
|
@@ -406,6 +420,7 @@ public void testLdapAuthentication() throws Exception { | |
.param("default_email", "[email protected]") | ||
.param("default_storage", "100000000") | ||
), JsonObject.class); | ||
configLdapChanged = true; | ||
|
||
// Get the LDAP configuration | ||
json = target().path("/app/config_ldap").request() | ||
|
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
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