Exemple #1
0
 def setUp(self):
     self.conn = RGWAdminConnection(ACCESS_KEY, SECRET_KEY)
     self.usagemgr = RGWUsageManager(self.conn)
     self.usermgr = RGWUserManager(self.conn)
     self.bucketmgr = RGWBucketManager(self.conn)
     self.subusermgr = RGWSubuserManager(self.conn)
Exemple #2
0
class RadosGWAdminTest(TestCase):
    
    def setUp(self):
        self.conn = RGWAdminConnection(ACCESS_KEY, SECRET_KEY)
        self.usagemgr = RGWUsageManager(self.conn)
        self.usermgr = RGWUserManager(self.conn)
        self.bucketmgr = RGWBucketManager(self.conn)
        self.subusermgr = RGWSubuserManager(self.conn)
        
    def tearDown(self):
        pass
    
    def test_create_user(self, user_info):
        user = self.usermgr.create(user_info)
        print(user)

    def test_get_bucket(self,bucket_info):
        bucket = self.bucketmgr.get_info(bucket_info)
        print(bucket)

    def test_link_bucket(self,bucket_info):
        bucket = self.bucketmgr.link(bucket_info)
        print(bucket)

    def test_get_bucket_policy(self,bucket_info):
        bucket = self.bucketmgr.get_policy(bucket_info)
        print(bucket)

    def test_remove_bucket(self,bucket_info):
        bucket = self.bucketmgr.remove(bucket_info)
        print(bucket)

    def test_get_user(self,user_info):
        user = self.usermgr.get(user_info)
        print(user)

    def test_create_subuser(self,subuser_info):
        subuser = self.subusermgr.create_subuser(subuser_info)
        print(subuser)


    def test_remove_subuser(self,subuser_info):
        subuser = self.subusermgr.remove_subuser(subuser_info)
        print(subuser)

    def test_create_key(self,user_info):
        key = self.usermgr.create_key(user_info)
        print(key)

    def test_get_user_quota(self,uid):
        user = self.usermgr.get_user_quota(uid)
        print(user)
    
    def test_set_user_quota(self,quota_info):
        '''
        quota_info = {uid':ID, 'max_size_kb':SIZE, 'max_objects':SIZE, enabled':true}

        '''
        user = self.usermgr.set_user_quota(uid=quota_info['uid'], max_size_kb=quota_info['max_size_kb'],
                                           max_objects=None, enabled=quota_info['enabled'])
        print(user)