How to use check_endpoint_group method in tempest

Best Python code snippet using tempest_python

test_endpoint_groups.py

Source:test_endpoint_groups.py Github

copy

Full Screen

...13from keystoneauth1.exceptions import http14from keystoneclient.tests.functional import base15from keystoneclient.tests.functional.v3 import client_fixtures as fixtures16class EndpointGroupsTestMixin(object):17 def check_endpoint_group(self, endpoint_group, endpoint_group_ref=None):18 self.assertIsNotNone(endpoint_group.id)19 self.assertIn('self', endpoint_group.links)20 self.assertIn('/endpoint_groups/' + endpoint_group.id,21 endpoint_group.links['self'])22 if endpoint_group_ref:23 self.assertEqual(endpoint_group_ref['name'], endpoint_group.name)24 self.assertEqual(endpoint_group_ref['filters'],25 endpoint_group.filters)26 # There is no guarantee description is present in endpoint groups27 if hasattr(endpoint_group_ref, 'description'):28 self.assertEqual(endpoint_group_ref['description'],29 endpoint_group.description)30 else:31 # Only check remaining mandatory attributes32 self.assertIsNotNone(endpoint_group.name)33 self.assertIsNotNone(endpoint_group.filters)34class EndpointGroupsTestCase(base.V3ClientTestCase, EndpointGroupsTestMixin):35 def test_create_endpoint_group(self):36 endpoint_group_ref = {37 'name': fixtures.RESOURCE_NAME_PREFIX + uuid.uuid4().hex,38 'filters': {'interface': 'internal'},39 'description': uuid.uuid4().hex}40 endpoint_group = self.client.endpoint_groups.create(41 **endpoint_group_ref)42 self.addCleanup(self.client.endpoint_groups.delete, endpoint_group)43 self.check_endpoint_group(endpoint_group, endpoint_group_ref)44 def test_get_endpoint_group(self):45 endpoint_group = fixtures.EndpointGroup(self.client)46 self.useFixture(endpoint_group)47 endpoint_ret = self.client.endpoint_groups.get(endpoint_group.id)48 self.check_endpoint_group(endpoint_ret, endpoint_group.ref)49 self.assertRaises(http.NotFound,50 self.client.endpoint_groups.get,51 uuid.uuid4().hex)52 def test_check_endpoint_group(self):53 endpoint_group = fixtures.EndpointGroup(self.client)54 self.useFixture(endpoint_group)55 self.client.endpoint_groups.check(endpoint_group.id)56 self.assertRaises(http.NotFound,57 self.client.endpoint_groups.check,58 uuid.uuid4().hex)59 def test_list_endpoint_groups(self):60 endpoint_group_one = fixtures.EndpointGroup(self.client)61 self.useFixture(endpoint_group_one)62 endpoint_group_two = fixtures.EndpointGroup(self.client)63 self.useFixture(endpoint_group_two)64 endpoint_groups = self.client.endpoint_groups.list()65 # All endpoints are valid66 for endpoint_group in endpoint_groups:67 self.check_endpoint_group(endpoint_group)68 self.assertIn(endpoint_group_one.entity, endpoint_groups)69 self.assertIn(endpoint_group_two.entity, endpoint_groups)70 def test_update_endpoint_group(self):71 endpoint_group = fixtures.EndpointGroup(self.client)72 self.useFixture(endpoint_group)73 new_name = fixtures.RESOURCE_NAME_PREFIX + uuid.uuid4().hex74 new_filters = {'interface': 'public'}75 new_description = uuid.uuid4().hex76 endpoint_group_ret = self.client.endpoint_groups.update(77 endpoint_group,78 name=new_name,79 filters=new_filters,80 description=new_description)81 endpoint_group.ref.update({'name': new_name, 'filters': new_filters,82 'description': new_description})83 self.check_endpoint_group(endpoint_group_ret, endpoint_group.ref)84 def test_delete_endpoint_group(self):85 endpoint_group = self.client.endpoint_groups.create(86 name=fixtures.RESOURCE_NAME_PREFIX + uuid.uuid4().hex,87 filters={'interface': 'admin'},88 description=uuid.uuid4().hex)89 self.client.endpoint_groups.delete(endpoint_group.id)90 self.assertRaises(http.NotFound,91 self.client.endpoint_groups.check,92 endpoint_group.id)93 self.assertRaises(http.NotFound,94 self.client.endpoint_groups.get,...

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