Ejemplo n.º 1
0
 def test_create_user(self):
   self.assertEqual(user.createSystemUser(self._testUser, password='******'), 0)
   self.assertIn(self._testUser, user.listRegularSystemUsers())
   self.assertTrue(user.checkPasswordSystemUser(self._testUser, 'test', mountPoint='/'))
   self.assertFalse(user.checkPasswordSystemUser(self._testUser, 'test2'))
   self.assertEqual(user.deleteSystemUser(self._testUser), 0)
   self.assertNotIn(self._testUser, user.listRegularSystemUsers())
   self.assertEqual(user.createSystemUser(self._testUser, mountPoint='/./'), 0)  # to be different than '/' and to really force the chroot ;-)
   self.assertIn(self._testUser, user.listRegularSystemUsers())
   self.assertEqual(user.changePasswordSystemUser(self._testUser, 'test'), 0)
   self.assertTrue(user.checkPasswordSystemUser(self._testUser, 'test'))
   self.assertFalse(user.checkPasswordSystemUser(self._testUser, 'test3'))
   self.assertEqual(user.deleteSystemUser(self._testUser, mountPoint='/./'), 0)
   self.assertNotIn(self._testUser, user.listRegularSystemUsers())
Ejemplo n.º 2
0
 def tearDown(self):
   if self._testUser in open('/etc/passwd').read():
     try:
       user.deleteSystemUser(self._testUser)
     except:
       pass  # not a problem