How to use list_metering_label_rules method in tempest

Best Python code snippet using tempest_python

test_metering_extensions.py

Source:test_metering_extensions.py Github

copy

Full Screen

...44 # Deletes a rule and verifies if it is deleted or not45 self.admin_client.delete_metering_label_rule(46 metering_label_rule_id)47 # Asserting that the rule is not found in list after deletion48 rules = (self.admin_client.list_metering_label_rules(49 id=metering_label_rule_id))50 self.assertEqual(len(rules['metering_label_rules']), 0)51 @test.idempotent_id('05d7c750-6d26-44d6-82f3-c9dd1f81f358')52 def test_list_metering_labels(self):53 # Verify label filtering54 body = self.admin_client.list_metering_labels(id=33)55 metering_labels = body['metering_labels']56 self.assertEqual(0, len(metering_labels))57 @test.idempotent_id('ec8e15ff-95d0-433b-b8a6-b466bddb1e50')58 def test_create_delete_metering_label_with_filters(self):59 # Creates a label60 name = data_utils.rand_name('metering-label-')61 description = "label created by tempest"62 body = self.admin_client.create_metering_label(name=name,63 description=description)64 metering_label = body['metering_label']65 self.addCleanup(self._delete_metering_label,66 metering_label['id'])67 # Assert whether created labels are found in labels list or fail68 # if created labels are not found in labels list69 labels = (self.admin_client.list_metering_labels(70 id=metering_label['id']))71 self.assertEqual(len(labels['metering_labels']), 1)72 @test.idempotent_id('cfc500d9-9de6-4847-8803-62889c097d45')73 def test_show_metering_label(self):74 # Verifies the details of a label75 body = self.admin_client.show_metering_label(self.metering_label['id'])76 metering_label = body['metering_label']77 self.assertEqual(self.metering_label['id'], metering_label['id'])78 self.assertEqual(self.metering_label['tenant_id'],79 metering_label['tenant_id'])80 self.assertEqual(self.metering_label['name'], metering_label['name'])81 self.assertEqual(self.metering_label['description'],82 metering_label['description'])83 @test.idempotent_id('cc832399-6681-493b-9d79-0202831a1281')84 def test_list_metering_label_rules(self):85 # Verify rule filtering86 body = self.admin_client.list_metering_label_rules(id=33)87 metering_label_rules = body['metering_label_rules']88 self.assertEqual(0, len(metering_label_rules))89 @test.idempotent_id('f4d547cd-3aee-408f-bf36-454f8825e045')90 def test_create_delete_metering_label_rule_with_filters(self):91 # Creates a rule92 remote_ip_prefix = ("10.0.1.0/24" if self._ip_version == 493 else "fd03::/64")94 body = (self.admin_client.create_metering_label_rule(95 remote_ip_prefix=remote_ip_prefix,96 direction="ingress",97 metering_label_id=self.metering_label['id']))98 metering_label_rule = body['metering_label_rule']99 self.addCleanup(self._delete_metering_label_rule,100 metering_label_rule['id'])101 # Assert whether created rules are found in rules list or fail102 # if created rules are not found in rules list103 rules = (self.admin_client.list_metering_label_rules(104 id=metering_label_rule['id']))105 self.assertEqual(len(rules['metering_label_rules']), 1)106 @test.idempotent_id('b7354489-96ea-41f3-9452-bace120fb4a7')107 def test_show_metering_label_rule(self):108 # Verifies the details of a rule109 body = (self.admin_client.show_metering_label_rule(110 self.metering_label_rule['id']))111 metering_label_rule = body['metering_label_rule']112 self.assertEqual(self.metering_label_rule['id'],113 metering_label_rule['id'])114 self.assertEqual(self.metering_label_rule['remote_ip_prefix'],115 metering_label_rule['remote_ip_prefix'])116 self.assertEqual(self.metering_label_rule['direction'],117 metering_label_rule['direction'])...

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