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())
def test_list_users(self): users = user.listRegularSystemUsers() self.assertGreater(len(users), 0)