def test_02_sync_many_empty_account(self): """Many empty account with meta data.""" index = {} # Create account self.created = filler.create_swift_account(self.o_ks_client, self.pile, 3, 1, index) for account, account_id, username in ( self.extract_created_a_u_iter(self.created)): # Post meta data on account tenant_cnx = sclient.Connection(self.o_st, "%s:%s" % (account, username), self.default_user_password, auth_version=2) filler.create_account_meta(tenant_cnx) # Start sync process self.swsync.process() # Now verify dest for account, account_id, username in ( self.extract_created_a_u_iter(self.created)): alo = self.get_account_detail(account_id, self.o_admin_token, 'orig') ald = self.get_account_detail(account_id, self.d_admin_token, 'dest') self.verify_aco_diff(alo, ald)
def test_02_sync_many_empty_account(self): """Many empty account with meta data """ index = {} # Create account self.created = filler.create_swift_account(self.o_ks_client, self.pile, 3, 1, index) for account, account_id, username in \ self.extract_created_a_u_iter(self.created): # Post meta data on account tenant_cnx = sclient.Connection(self.o_st, "%s:%s" % (account, username), self.default_user_password, auth_version=2) filler.create_account_meta(tenant_cnx) # Start sync process self.swsync.process() # Now verify dest for account, account_id, username in \ self.extract_created_a_u_iter(self.created): alo = self.get_account_detail(account_id, self.o_admin_token, 'orig') ald = self.get_account_detail(account_id, self.d_admin_token, 'dest') self.verify_aco_diff(alo, ald)
def test_05_account_two_passes(self): """Account modified two sync passes """ index = {} # create account self.created = filler.create_swift_account(self.o_ks_client, self.pile, 3, 1, index) for account, account_id, username in \ self.extract_created_a_u_iter(self.created): # post meta data on account tenant_cnx = sclient.Connection(self.o_st, "%s:%s" % (account, username), self.default_user_password, auth_version=2) filler.create_account_meta(tenant_cnx) # start sync process self.swsync.process() # Add more meta to account for account, account_id, username in \ self.extract_created_a_u_iter(self.created): # Modify meta data on account tenant_cnx = sclient.Connection(self.o_st, "%s:%s" % (account, username), self.default_user_password, auth_version=2) token = tenant_cnx.get_auth()[1] # Remove one, modify one, and add one meta a_meta = self.get_account_meta(account_id, token, 'orig') a_meta_k_names = [k.split('-')[-1] for k in a_meta] headers = {} headers['X-Account-Meta-a1'] = 'b1' headers["X-Remove-Account-Meta-%s" % a_meta_k_names[0]] = 'x' headers["X-Account-Meta-%s" % a_meta_k_names[1]] = 'b2' self.post_account(account_id, token, 'orig', headers=headers) # Re - start sync process self.swsync.process() # Now verify dest for account, account_id, username in \ self.extract_created_a_u_iter(self.created): alo = self.get_account_detail(account_id, self.o_admin_token, 'orig') ald = self.get_account_detail(account_id, self.d_admin_token, 'dest') self.verify_aco_diff(alo, ald)
def test_01_sync_one_of_two_empty_accounts(self): """create two empty accounts, Sync only one """ index = {} test_account_name = "account_test" # create account self.created = filler.create_swift_account(self.o_ks_client, self.pile, 2, 1, index) for account, account_id, username in \ self.extract_created_a_u_iter(self.created): # post meta data on account tenant_cnx = sclient.Connection(self.o_st, "%s:%s" % (account, username), self.default_user_password, auth_version=2) filler.create_account_meta(tenant_cnx) # select random account and write it in the filter file t_account, t_account_id, t_username = random.choice(list( self.extract_created_a_u_iter(self.created))) with open(self.filter_filename, "w") as filterlist: filterlist.write(t_account + "\n") # start sync process self.swsync.process() # Now verify dest for account, account_id, username in \ self.extract_created_a_u_iter(self.created): alo = self.get_account_detail(account_id, self.o_admin_token, 'orig') ald = self.get_account_detail(account_id, self.d_admin_token, 'dest') if account == t_account: self.verify_aco_diff(alo, ald)
def test_01_sync_one_of_two_empty_accounts(self): """Create two empty accounts, Sync only one.""" index = {} # create account self.created = filler.create_swift_account(self.o_ks_client, self.pile, 2, 1, index) for account, account_id, username in (self.extract_created_a_u_iter( self.created)): # post meta data on account tenant_cnx = sclient.Connection(self.o_st, "%s:%s" % (account, username), self.default_user_password, auth_version=2) filler.create_account_meta(tenant_cnx) # select random account and write it in the filter file t_account, t_account_id, t_username = random.choice( list(self.extract_created_a_u_iter(self.created))) with open(self.filter_filename, "w") as filterlist: filterlist.write(t_account + "\n") # start sync process self.swsync.process() # Now verify dest for account, account_id, username in (self.extract_created_a_u_iter( self.created)): alo = self.get_account_detail(account_id, self.o_admin_token, 'orig') ald = self.get_account_detail(account_id, self.d_admin_token, 'dest') if account == t_account: self.verify_aco_diff(alo, ald)