Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 29 additions & 8 deletions src/org/labkey/test/tests/SecurityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected String getProjectName()
@BeforeClass
public static void setupProject()
{
((SecurityTest)getCurrentTest()).doSetup();
((SecurityTest) getCurrentTest()).doSetup();
}

protected void doSetup()
Expand Down Expand Up @@ -425,9 +425,9 @@ protected void checkGroupMembership(String userName, String groupName, int expec
if (isPresent)
{
clickAndWait(userAccessLink);

// check for the expected number of group membership links (note: they may be hidden by expandos)
click(Locator.xpath("//tr[td/a[text()='" + getProjectName() + "']]//img" ));
click(Locator.xpath("//tr[td/a[text()='" + getProjectName() + "']]//img"));
assertElementPresent(Locator.linkWithText(groupName), expectedCount);
return;
}
Expand Down Expand Up @@ -476,10 +476,10 @@ protected void impersonationTest()
DataRegionTable table = new DataRegionTable("query", getDriver());

table.getDataAsText(2, 2);
String createdBy = table.getDataAsText(2, "Created By");
String createdBy = table.getDataAsText(2, "Created By");
String impersonatedBy = table.getDataAsText(2, "Impersonated By");
String user = table.getDataAsText(2, "User");
String comment = table.getDataAsText(2, "Comment");
String user = table.getDataAsText(2, "User");
String comment = table.getDataAsText(2, "Comment");

assertTrue("Incorrect display for deleted user -- expected '<nnnn>', found '" + user + "'", user.matches("<\\d{4,}>"));
assertEquals("Incorrect log entry for deleted user",
Expand All @@ -504,7 +504,7 @@ public void loginSelfRegistrationEnabledTest()
_userHelper.deleteUsers(false, selfRegUserEmail);

int getResponse = setAuthenticationParameter("SelfRegistration", true);
assertEquals("failed to set authentication param to enable self register via http get", 200, getResponse );
assertEquals("failed to set authentication param to enable self register via http get", 200, getResponse);
signOut();

// test: attempt login, check if register button appears, click register
Expand Down Expand Up @@ -551,4 +551,25 @@ public void loginSelfRegistrationDisabledTest()
// cleanup: sign admin back in
signIn();
}
}

@LogMethod
@Test
public void invokeMutatingSqlAction()
{
// Ensure that a GET request invoking mutating SQL is flagged
String feature = "AllowMutatingSqlViaGet";
Connection conn = createDefaultConnection();
OptionalFeatureHelper.disableOptionalFeature(conn, feature);
beginAt(buildURL("test", "executeMutatingSql"));
assertTextPresent("MUTATING SQL executed as part of handling action: GET org.labkey.devtools.TestController$ExecuteMutatingSqlAction");
checkExpectedErrors(2);

// Turn on the deprecated feature flag and ensure that GET request can invoke mutating SQL
OptionalFeatureHelper.enableOptionalFeature(conn, feature);
beginAt(buildURL("test", "executeMutatingSql"));
assertTextPresent("UPDATE via GET was allowed!");

// Restore flag to original value
OptionalFeatureHelper.resetOptionalFeature(conn, feature);
}
}
2 changes: 1 addition & 1 deletion src/org/labkey/test/util/DeferredErrorCollector.java
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public void reportResults()
{
if (allErrors.getLast().getScreenshotName() == null)
{
withScreenshot("fallback").error("No screeshot taken for last deferred error(s). " +
withScreenshot("fallback").error("No screenshot taken for last deferred error(s). " +
"This screenshot may be relevant to previous failures. " +
"Please update test to take appropriate screenshots.");
}
Expand Down