Project

General

Profile

« Previous | Next » 

Revision 8422

Added by Jing Tao over 10 years ago

Add an test method for adding a user.

View differences:

AuthFileTest.java
26 26
public class AuthFileTest extends MCTestCase {
27 27
    private static final String PASSWORDFILEPATH = "build/password";
28 28
    private static final String GROUPNAME = "nceas-dev";
29
    private static final String USERNAME = "uid=tao,o=NCEAS,dc=ecoinformatics,dc=org";
30
    private static final String PASSWORD = "ecoinformatics";
29 31
    /**
30 32
     * consstructor for the test
31 33
     */
......
55 57
     public static Test suite() 
56 58
     {
57 59
         TestSuite suite = new TestSuite();
58
         //suite.addTest(new AuthFileTest(""));
59 60
         suite.addTest(new AuthFileTest("testAddGroup"));
61
         suite.addTest(new AuthFileTest("testAddUser"));
60 62
         return suite;
61 63
     }
62 64
     
......
75 77
         }
76 78
         
77 79
     }
80
     
81
     /**
82
      * Test the addGroup method
83
      * @throws Exception
84
      */
85
     public void testAddUser() throws Exception{
86
         AuthFile authFile = AuthFile.getInstance(PASSWORDFILEPATH);
87
         String[]groups = {GROUPNAME};
88
         authFile.addUser(USERNAME, groups, PASSWORD);
89
         try {
90
             authFile.addUser(USERNAME, groups, PASSWORD);
91
             assertTrue("We can't reach here since we can't add the user twice", false);
92
         } catch (AuthenticationException e) {
93
             
94
         }
95
         
96
     }
78 97
}

Also available in: Unified diff