assertRepositoriesPage();
}
- @Test( dependsOnMethods = { "testAddManagedRepoValidValues" }, enabled = false )
+ @Test( dependsOnMethods = { "testAddManagedRepoValidValues" } )
public void testAddManagedRepoInvalidValues()
{
getSelenium().open( "/archiva/admin/addRepository.action" );
"Index directory must only contain alphanumeric characters, equals(=), question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-)." );
assertTextPresent( "Repository Purge By Retention Count needs to be between 1 and 100." );
assertTextPresent( "Repository Purge By Days Older Than needs to be larger than 0." );
- // FIXME: broken
- assertTextPresent( "Invalid cron expression." );
+ assertTextPresent( "Cron expression is required." );
}
@Test
assertTextPresent( "Repository Purge By Days Older Than needs to be larger than 0." );
}
- @Test( enabled = false )
+ @Test
public void testAddManagedRepoBlankValues()
{
getSelenium().open( "/archiva/admin/addRepository.action" );
assertTextPresent( "You must enter a repository identifier." );
assertTextPresent( "You must enter a repository name." );
assertTextPresent( "You must enter a directory." );
- // FIXME: broken
- assertTextPresent( "Invalid cron expression." );
+ assertTextPresent( "Cron expression is required." );
}
@Test
assertTextPresent( "You must enter a directory." );
}
- @Test( enabled = false )
+ @Test
public void testAddManagedRepoNoCron()
{
getSelenium().open( "/archiva/admin/addRepository.action" );
addManagedRepository( "identifier", "name", "/home", "/.index", "Maven 2.x Repository", "", "", "", false );
- // FIXME: broken
- assertTextPresent( "Invalid cron expression." );
+ assertTextPresent( "Cron expression is required." );
}
@Test
assertTextPresent( "Managed Repository Sample" );
}
- @Test( dependsOnMethods = { "testAddManagedRepoForEdit" }, enabled = false )
+ @Test( dependsOnMethods = { "testAddManagedRepoForEdit" } )
public void testEditManagedRepoInvalidValues()
{
editManagedRepository( "<>\\~+[]'\"", "<> ~+[ ]'\"", "<> ~+[ ]'\"", "Maven 2.x Repository", "", "-1", "101" );
"Index directory must only contain alphanumeric characters, equals(=), question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-)." );
assertTextPresent( "Repository Purge By Retention Count needs to be between 1 and 100." );
assertTextPresent( "Repository Purge By Days Older Than needs to be larger than 0." );
- // FIXME: broken
- assertTextPresent( "Invalid cron expression." );
+ assertTextPresent( "Cron expression is required." );
}
@Test( dependsOnMethods = { "testAddManagedRepoForEdit" } )
"Index directory must only contain alphanumeric characters, equals(=), question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-)." );
}
- @Test( dependsOnMethods = { "testAddManagedRepoForEdit" }, enabled = false )
- public void testEditManagedRepoInvalidCron()
+ @Test( dependsOnMethods = { "testAddManagedRepoForEdit" } )
+ public void testEditManagedRepoInvalidCronBadText()
+ {
+ editManagedRepository( "name", "/home", "/.index", "Maven 2.x Repository", "asdf", "1", "1" );
+ assertTextPresent( "Invalid cron expression." );
+ }
+
+ @Test( dependsOnMethods = { "testAddManagedRepoForEdit" } )
+ public void testEditManagedRepoInvalidCronBadValue()
+ {
+ editManagedRepository( "name", "/home", "/.index", "Maven 2.x Repository", "60 0 * * * ?", "1", "1" );
+ assertTextPresent( "Invalid cron expression." );
+ }
+
+ @Test( dependsOnMethods = { "testAddManagedRepoForEdit" } )
+ public void testEditManagedRepoInvalidCronTooManyElements()
{
- editManagedRepository( "name", "/home", "/.index", "Maven 2.x Repository", "", "1", "1" );
- // FIXME: broken
+ editManagedRepository( "name", "/home", "/.index", "Maven 2.x Repository", "* * * * * * * *", "1", "1" );
assertTextPresent( "Invalid cron expression." );
}
assertPage( "Collection: /" );
assertTextPresent( "Collection: /" );
}
-}
\ No newline at end of file
+}
assertTextPresent( "Possible CSRF attack detected! Invalid token found in the request." );
}
- @Test( enabled = false )
+ @Test
public void testAddManagedRepositoryImmunityToInputFieldCrossSiteScripting()
{
+ // TODO: these are evaluated client side now - we should force it to do server-side to make sure (though this could probably be tested in the webapp tests instead)
getSelenium().open( "/archiva/admin/addRepository.action" );
addManagedRepository( "test\"><script>alert('xss')</script>", "test\"><script>alert('xss')</script>",
"test\"><script>alert('xss')</script>", "test\"><script>alert('xss')</script>",
"Index directory must only contain alphanumeric characters, equals(=), question-marks(?), exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-)." );
assertTextPresent( "Repository Purge By Retention Count needs to be between 1 and 100." );
assertTextPresent( "Repository Purge By Days Older Than needs to be larger than 0." );
- // FIXME: broken
+ assertTextPresent( "Cron expression is required." );
+ }
+
+ @Test
+ public void testAddManagedRepositoryImmunityToInputFieldCrossSiteScriptingCron()
+ {
+ // separate test because cron is evaluated server side, not client side
+ getSelenium().open( "/archiva/admin/addRepository.action" );
+ addManagedRepository( "id", "name", "/home", "/.index", "Maven 2.x Repository",
+ "<test\"><script>alert('xss')</script>", "1", "1", true );
assertTextPresent( "Invalid cron expression." );
}
assertTextPresent(
"Username must only contain alphanumeric characters, at's(@), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), and dashes(-)." );
}
-}
\ No newline at end of file
+}