Example #1
0
 def setUp(self):
     cleanLdap()
     self.l = ldapUserGroupControl("tests-mds/basetest.ini")
     self.l.addGroup("allusers")
     self.u = UserQuotaControl(conffile = "tests-mds/userquotatest.ini", conffilebase = "tests-mds/basetest.ini")
Example #2
0
 def setUp(self):
     cleanLdap()
     self.l = ldapUserGroupControl("tests-mds/basetest.ini")
     self.l.addGroup("allusers")
     self.u = UserQuotaControl(conffile="tests-mds/userquotatest.ini",
                               conffilebase="tests-mds/basetest.ini")
Example #3
0
class testUserquota(unittest.TestCase):

    def setUp(self):
        cleanLdap()
        self.l = ldapUserGroupControl("tests-mds/basetest.ini")
        self.l.addGroup("allusers")
        self.u = UserQuotaControl(conffile = "tests-mds/userquotatest.ini", conffilebase = "tests-mds/basetest.ini")

    def test_quota(self):
        self.l.addUser("usertest", "userpass", "firstname", "sn")
        self.u.setDiskQuota("usertest", "/dev/hda1:1024:Root", "100")
        self.assertEqual(self.u.hasDiskQuotaObjectClass("usertest"), True)
        self.u.deleteDiskQuota("usertest", "/dev/hda1:1024:Root")
        self.assertEqual(self.u.hasDiskQuotaObjectClass("usertest"), False)
        self.u.setNetworkQuota("usertest", "Internet:0.0.0.0/0:any", "100")
        self.assertEqual(self.u.hasDiskQuotaObjectClass("usertest"), True)
        self.u.deleteNetworkQuota("usertest", "Internet:0.0.0.0/0:any")
        self.assertEqual(self.u.hasDiskQuotaObjectClass("usertest"), False)
Example #4
0
class testUserquota(unittest.TestCase):
    def setUp(self):
        cleanLdap()
        self.l = ldapUserGroupControl("tests-mds/basetest.ini")
        self.l.addGroup("allusers")
        self.u = UserQuotaControl(conffile="tests-mds/userquotatest.ini",
                                  conffilebase="tests-mds/basetest.ini")

    def test_quota(self):
        self.l.addUser("usertest", "userpass", "firstname", "sn")
        self.u.setDiskQuota("usertest", "/dev/hda1:1024:Root", "100")
        self.assertEqual(self.u.hasDiskQuotaObjectClass("usertest"), True)
        self.u.deleteDiskQuota("usertest", "/dev/hda1:1024:Root")
        self.assertEqual(self.u.hasDiskQuotaObjectClass("usertest"), False)
        self.u.setNetworkQuota("usertest", "Internet:0.0.0.0/0:any", "100")
        self.assertEqual(self.u.hasDiskQuotaObjectClass("usertest"), True)
        self.u.deleteNetworkQuota("usertest", "Internet:0.0.0.0/0:any")
        self.assertEqual(self.u.hasDiskQuotaObjectClass("usertest"), False)