Commits

Moises Henriquez committed 675500d

Fixed API calls on test_SKEL

Comments (0)

Files changed (1)

modules/support/vectorlinux/tests/test_SKEL.py

     def setUp(self):
         # create a fake user account.
         self.usermodel = USERADMIN.UserModel()
-        uname = 'fidencio'
-        realname = 'Fidencio Hdz'
-        groups = ['sys','adm','slocate','netdev','power']
-        password = 'mypassword'
-        ret, out = self.usermodel.create_new_account(
-            uname,
-            realname,
-            password,
-            groups
-            )
-        self.assertTrue(self.usermodel.user_exists('fidencio'))
+        self._fake_user = USERADMIN.User(login='fidencio', new=True)
+        if self.usermodel.hasUser(self._fake_user.login):
+            self.usermodel.deleteUser(self._fake_user.login)
+        self._fake_user.realname = 'Fidencio Hdz'
+        self._fake_user.groups = ['sys', 'adm', 'slocate', 'netdev', 'power']
+        self._fake_user.password = 'secrepassword'
+        self.usermodel.addUser(self._fake_user)
+        
+        self.assertTrue(self.usermodel.hasUser('fidencio'))
         self.SkelModel = SKEL.UserSkel('fidencio')
         self.addCleanup(self._custom_cleanup)
 
         return self.assertTrue(self.SkelModel.reset_settings([f]))
 
     def _custom_cleanup(self):
-        code, output = self.usermodel.delete_user('fidencio')
+        if self.usermodel.hasUser(self._fake_user.login):
+            self.usermodel.deleteUser(self._fake_user.login)
 
     def tearDown(self):
         # delete the created user
-        code, output = self.usermodel.delete_user('fidencio')
+        if self.usermodel.hasUser(self._fake_user.login):
+            self.usermodel.deleteUser(self._fake_user.login)
         super(TestSkel, self).tearDown()
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.