How to use list_metering_labels method in tempest

Best Python code snippet using tempest_python

test_metering_extensions.py

Source:test_metering_extensions.py Github

copy

Full Screen

...39 def _delete_metering_label(self, metering_label_id):40 # Deletes a label and verifies if it is deleted or not41 self.admin_client.delete_metering_label(metering_label_id)42 # Asserting that the label is not found in list after deletion43 labels = self.admin_client.list_metering_labels(id=metering_label_id)44 self.assertEqual(len(labels['metering_labels']), 0)45 def _delete_metering_label_rule(self, metering_label_rule_id):46 # Deletes a rule and verifies if it is deleted or not47 self.admin_client.delete_metering_label_rule(48 metering_label_rule_id)49 # Asserting that the rule is not found in list after deletion50 rules = (self.admin_client.list_metering_label_rules(51 id=metering_label_rule_id))52 self.assertEqual(len(rules['metering_label_rules']), 0)53 @test.idempotent_id('05d7c750-6d26-44d6-82f3-c9dd1f81f358')54 def test_list_metering_labels(self):55 # Verify label filtering56 body = self.admin_client.list_metering_labels(id=33)57 metering_labels = body['metering_labels']58 self.assertEqual(0, len(metering_labels))59 @test.idempotent_id('ec8e15ff-95d0-433b-b8a6-b466bddb1e50')60 def test_create_delete_metering_label_with_filters(self):61 # Creates a label62 name = data_utils.rand_name('metering-label-')63 description = "label created by tempest"64 body = self.admin_client.create_metering_label(name=name,65 description=description)66 metering_label = body['metering_label']67 self.addCleanup(self._delete_metering_label,68 metering_label['id'])69 # Assert whether created labels are found in labels list or fail70 # if created labels are not found in labels list71 labels = (self.admin_client.list_metering_labels(72 id=metering_label['id']))73 self.assertEqual(len(labels['metering_labels']), 1)74 @test.idempotent_id('46608f8d-2e27-4eb6-a0b4-dbe405144c4d')75 def test_create_delete_metering_label_with_name_max_length(self):76 name = LONG_NAME_OK77 body = self.admin_client.create_metering_label(name=name)78 metering_label = body['metering_label']79 self.addCleanup(self._delete_metering_label,80 metering_label['id'])81 labels = (self.admin_client.list_metering_labels(82 id=metering_label['id']))83 self.assertEqual(len(labels['metering_labels']), 1)84 @test.idempotent_id('cfc500d9-9de6-4847-8803-62889c097d45')85 def test_show_metering_label(self):86 # Verifies the details of a label87 body = self.admin_client.show_metering_label(self.metering_label['id'])88 metering_label = body['metering_label']89 self.assertEqual(self.metering_label['id'], metering_label['id'])90 self.assertEqual(self.metering_label['tenant_id'],91 metering_label['tenant_id'])92 self.assertEqual(self.metering_label['name'], metering_label['name'])93 self.assertEqual(self.metering_label['description'],94 metering_label['description'])95 @test.idempotent_id('cc832399-6681-493b-9d79-0202831a1281')...

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