Skip to content
Snippets Groups Projects
Commit 7a626247 authored by Alinga Yeung's avatar Alinga Yeung
Browse files

Story 1890. Fixed unit test and integration test errors. The tests now use the...

Story 1890. Fixed unit test and integration test errors. The tests now use the test/LdapConfig.properties file.
parent 92674924
Branches
Tags
No related merge requests found
......@@ -83,6 +83,7 @@ import org.junit.Test;
import ca.nrc.cadc.ac.User;
import ca.nrc.cadc.ac.server.UserPersistence;
import ca.nrc.cadc.auth.HttpPrincipal;
import ca.nrc.cadc.util.PropertiesReader;
@SuppressWarnings("unchecked")
......@@ -96,6 +97,7 @@ public class CommandRunnerTest
{
// Set the necessary JNDI system property for lookups.
System.setProperty("java.naming.factory.initial", ContextFactoryImpl.class.getName());
System.setProperty(PropertiesReader.class.getName() + ".dir", "./test/");
}
......
......@@ -117,9 +117,8 @@ public class UserAdminIntTest
testCert = System.getProperty("user.dir")
+ "/build/test/class/cadcauthtest1.pem";
System.setProperty(PropertiesReader.class.getName() + ".dir", "./test/");
config = LdapConfig.getLdapConfig();
System.setProperty(PropertiesReader.class.getName() + ".dir", "test");
}
@Test
......@@ -202,7 +201,8 @@ public class UserAdminIntTest
boolean isPending = true;
addUser(userID, isPending);
String[] args = new String[] { "--approve=" + userID };
String[] args = new String[] { "--approve=" + userID,
"--dn=UID=" + userID + ",OU=Users,OU=ds,DC=testcanfar"};
doTest(args);
log.debug("output: " + output);
......@@ -211,8 +211,10 @@ public class UserAdminIntTest
assertTrue("User not approved.",
output.toString().contains("was approved"));
User<Principal> deletedUser = getUser(userID, true, false);
User<Principal> approvedUser = getUser(userID, false, true);
// get deleted user
getUser(userID, true, false);
// get approved user
getUser(userID, false, true);
}
@Test
......@@ -220,7 +222,8 @@ public class UserAdminIntTest
{
String userID = "foo_" + System.currentTimeMillis();
String[] args = new String[] { "--approve=" + userID };
String[] args = new String[] { "--approve=" + userID,
"--dn=UID=" + userID + ",OU=Users,OU=ds,DC=testcanfar"};
doTest(args);
......@@ -228,7 +231,7 @@ public class UserAdminIntTest
final String errorMessage = error.toString();
log.debug("output: " + outputMessage);
assertTrue(outputMessage.contains("not found"));
assertTrue(outputMessage.contains("not find pending user"));
assertFalse("Should not have error (" + errorMessage + ")",
StringUtil.hasLength(errorMessage));
}
......@@ -303,7 +306,9 @@ public class UserAdminIntTest
expected.getIdentities().add(userID);
expected.getIdentities().add(x500Principal);
expected.details.add(new PersonalDetails("foo", "bar"));
PersonalDetails pd = new PersonalDetails("foo", "bar");
pd.email = username + "@canada.ca";
expected.details.add(pd);
final UserRequest<Principal> userRequest =
new UserRequest<Principal>(expected, "123456".toCharArray());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment