How to use show_tenant method in tempest

Best Python code snippet using tempest_python

test_tenants.py

Source:test_tenants.py Github

copy

Full Screen

...48 tenant_id = tenant['id']49 desc1 = tenant['description']50 self.assertEqual(desc1, tenant_desc, 'Description should have '51 'been sent in response for create')52 body = self.tenants_client.show_tenant(tenant_id)['tenant']53 desc2 = body['description']54 self.assertEqual(desc2, tenant_desc, 'Description does not appear'55 'to be set')56 self.tenants_client.delete_tenant(tenant_id)57 self.data.tenants.remove(tenant)58 @test.idempotent_id('670bdddc-1cd7-41c7-b8e2-751cfb67df50')59 def test_tenant_create_enabled(self):60 # Create a tenant that is enabled61 tenant_name = data_utils.rand_name(name='tenant')62 body = self.tenants_client.create_tenant(tenant_name, enabled=True)63 tenant = body['tenant']64 self.data.tenants.append(tenant)65 tenant_id = tenant['id']66 en1 = tenant['enabled']67 self.assertTrue(en1, 'Enable should be True in response')68 body = self.tenants_client.show_tenant(tenant_id)['tenant']69 en2 = body['enabled']70 self.assertTrue(en2, 'Enable should be True in lookup')71 self.tenants_client.delete_tenant(tenant_id)72 self.data.tenants.remove(tenant)73 @test.idempotent_id('3be22093-b30f-499d-b772-38340e5e16fb')74 def test_tenant_create_not_enabled(self):75 # Create a tenant that is not enabled76 tenant_name = data_utils.rand_name(name='tenant')77 body = self.tenants_client.create_tenant(tenant_name, enabled=False)78 tenant = body['tenant']79 self.data.tenants.append(tenant)80 tenant_id = tenant['id']81 en1 = tenant['enabled']82 self.assertEqual('false', str(en1).lower(),83 'Enable should be False in response')84 body = self.tenants_client.show_tenant(tenant_id)['tenant']85 en2 = body['enabled']86 self.assertEqual('false', str(en2).lower(),87 'Enable should be False in lookup')88 self.tenants_client.delete_tenant(tenant_id)89 self.data.tenants.remove(tenant)90 @test.idempotent_id('781f2266-d128-47f3-8bdb-f70970add238')91 def test_tenant_update_name(self):92 # Update name attribute of a tenant93 t_name1 = data_utils.rand_name(name='tenant')94 body = self.tenants_client.create_tenant(t_name1)['tenant']95 tenant = body96 self.data.tenants.append(tenant)97 t_id = body['id']98 resp1_name = body['name']99 t_name2 = data_utils.rand_name(name='tenant2')100 body = self.tenants_client.update_tenant(t_id, name=t_name2)['tenant']101 resp2_name = body['name']102 self.assertNotEqual(resp1_name, resp2_name)103 body = self.tenants_client.show_tenant(t_id)['tenant']104 resp3_name = body['name']105 self.assertNotEqual(resp1_name, resp3_name)106 self.assertEqual(t_name1, resp1_name)107 self.assertEqual(resp2_name, resp3_name)108 self.tenants_client.delete_tenant(t_id)109 self.data.tenants.remove(tenant)110 @test.idempotent_id('859fcfe1-3a03-41ef-86f9-b19a47d1cd87')111 def test_tenant_update_desc(self):112 # Update description attribute of a tenant113 t_name = data_utils.rand_name(name='tenant')114 t_desc = data_utils.rand_name(name='desc')115 body = self.tenants_client.create_tenant(t_name, description=t_desc)116 tenant = body['tenant']117 self.data.tenants.append(tenant)118 t_id = tenant['id']119 resp1_desc = tenant['description']120 t_desc2 = data_utils.rand_name(name='desc2')121 body = self.tenants_client.update_tenant(t_id, description=t_desc2)122 updated_tenant = body['tenant']123 resp2_desc = updated_tenant['description']124 self.assertNotEqual(resp1_desc, resp2_desc)125 body = self.tenants_client.show_tenant(t_id)['tenant']126 resp3_desc = body['description']127 self.assertNotEqual(resp1_desc, resp3_desc)128 self.assertEqual(t_desc, resp1_desc)129 self.assertEqual(resp2_desc, resp3_desc)130 self.tenants_client.delete_tenant(t_id)131 self.data.tenants.remove(tenant)132 @test.idempotent_id('8fc8981f-f12d-4c66-9972-2bdcf2bc2e1a')133 def test_tenant_update_enable(self):134 # Update the enabled attribute of a tenant135 t_name = data_utils.rand_name(name='tenant')136 t_en = False137 body = self.tenants_client.create_tenant(t_name, enabled=t_en)138 tenant = body['tenant']139 self.data.tenants.append(tenant)140 t_id = tenant['id']141 resp1_en = tenant['enabled']142 t_en2 = True143 body = self.tenants_client.update_tenant(t_id, enabled=t_en2)144 updated_tenant = body['tenant']145 resp2_en = updated_tenant['enabled']146 self.assertNotEqual(resp1_en, resp2_en)147 body = self.tenants_client.show_tenant(t_id)['tenant']148 resp3_en = body['enabled']149 self.assertNotEqual(resp1_en, resp3_en)150 self.assertEqual('false', str(resp1_en).lower())151 self.assertEqual(resp2_en, resp3_en)152 self.tenants_client.delete_tenant(t_id)...

Full Screen

Full Screen

namespace

Source:namespace Github

copy

Full Screen

...26def namespace_show(args):27 bourne.connect(args.ip)28 namespace = bourne.namespace_show(args.namespace)29 bourne.pretty_print_json(namespace)30def namespace_show_tenant(args):31 bourne.connect(args.ip)32 tenant_namespace = bourne.namespace_show_tenant(args.tenant)33 bourne.pretty_print_json(tenant_namespace)34def namespace_list(args):35 bourne.connect(args.ip)36 uris = bourne.namespace_list()37 print uris38 for uri in uris:39 ns = bourne.namespace_show(uri)40 bourne.pretty_print_json(ns)41#----------------------------------------------------------------------42# command-line parsing43#44#----------------------------------------------------------------------45try:46 bourne_ip = os.environ['BOURNE_IPADDR']47except:48 bourne_ip = 'localhost'49# namespace <cmd> <cmd_args> [--ip ipaddr]50parser = argparse.ArgumentParser(description = 'Bourne namespace cli usage.')51parser.add_argument('cmd', help = 'cmd = (create | update | delete | show | show_tenant | list)')52parser.add_argument('--ip', metavar = 'ipaddr', help = 'IP address of bourne', default=bourne_ip)53# namespace create namespace project cos 54create = argparse.ArgumentParser(parents = [parser], conflict_handler='resolve')55create.add_argument('--tenant', metavar = 'tenant', help = 'tenant id or name', default = None)56create.add_argument('--namespace', help = 'namespace name')57create.add_argument('--project', help = 'default project name')58create.add_argument('--cos', help = 'default objcos name')59create.add_argument('--rg', help = 'default replication group name', default=None)60create.add_argument('--allowed_vpools_list', help = 'default replication group name', default=None)61# namespace update namespace project cos rg62update = argparse.ArgumentParser(parents = [parser], conflict_handler='resolve')63update.add_argument('--tenant', metavar = 'tenant', help = 'tenant id or name', default = None)64update.add_argument('--namespace', help = 'namespace name')65update.add_argument('--project', help = 'default project name')66update.add_argument('--rg', help = 'default replication group name', default=None)67update.add_argument('--vpools_added_to_allowed_vpools_list', help = 'vpool added to allowed list', default=None)68update.add_argument('--vpools_added_to_disallowed_vpools_list', help = 'vpool added to disAllowed list', default=None)69# namespace delete uri70delete = argparse.ArgumentParser(parents = [parser], conflict_handler='resolve')71delete.add_argument('namespace', help = 'namespace name')72# namespace show namespace73show = argparse.ArgumentParser(parents = [parser], conflict_handler='resolve')74show.add_argument('namespace', help = 'namespace name')75# namespace show_tenant tenant76show_tenant = argparse.ArgumentParser(parents = [parser], conflict_handler='resolve')77show_tenant.add_argument('--tenant', metavar = 'tenant', help = 'tenant id or name', default = None)78# namespace list79list = argparse.ArgumentParser(parents = [parser], conflict_handler='resolve')80#----------------------------------------------------------------------81# Main script82#----------------------------------------------------------------------83try:84 85 if (len(sys.argv) > 1):86 cmd = sys.argv[1]87 else:88 cmd = None89 bourne = Bourne()90 #bourne.connect(bourne_ip)91 92 #uri = bourne.tenant_getid()93 #print uri 94 if (cmd == "create"):95 args = create.parse_args()96 namespace_create(args)97 elif (cmd == "update"):98 args = update.parse_args()99 namespace_update(args)100 elif (cmd == "delete"):101 args = delete.parse_args()102 namespace_delete(args)103 elif (cmd == "show"):104 args = show.parse_args()105 namespace_show(args)106 elif (cmd == "show_tenant"):107 args = show_tenant.parse_args()108 namespace_show_tenant(args)109 elif (cmd == "list"):110 args = list.parse_args()111 namespace_list(args)112 elif (cmd == "sanity"):113 args = create.parse_args()114 bourne.connect(args.ip)115 # delete namespace if it exists116 ns_list = bourne.namespace_list()117 # create namespace if not exists yet118 if args.namespace in ns_list:119 print bourne.namespace_delete(args.namespace)120 loops = 1121 for i in range(loops):122 print bourne.namespace_create(args.tenant, args.namespace, args.project, args.cos, args.rg, args.allowed_vpools_list)123 print bourne.namespace_list()124 print bourne.namespace_show(args.namespace)125 print bourne.namespace_show_tenant(args.tenant)126 bourne.namespace_delete(args.namespace)127 else:128 parser.print_help()129except:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful