How to use _test_request_helper method in tempest

Best Python code snippet using tempest_python

test_auth.py

Source:test_auth.py Github

copy

Full Screen

...116 if attr == 'user_id':117 return access['user']['id']118 elif attr == 'tenant_id':119 return access['token']['tenant']['id']120 def _test_request_helper(self, filters, expected):121 url, headers, body = self.auth_provider.auth_request('GET',122 self.target_url,123 filters=filters)124 self.assertEqual(expected['url'], url)125 self.assertEqual(expected['token'], headers['X-Auth-Token'])126 self.assertEqual(expected['body'], body)127 def _auth_data_with_expiry(self, date_as_string):128 token, access = self.auth_provider.auth_data129 access['token']['expires'] = date_as_string130 return token, access131 def test_request(self):132 filters = {133 'service': 'compute',134 'endpoint_type': 'publicURL',135 'region': 'FakeRegion'136 }137 url = self._get_result_url_from_endpoint(138 self._endpoints[0]['endpoints'][1]) + '/' + self.target_url139 expected = {140 'body': None,141 'url': url,142 'token': self._get_token_from_fake_identity(),143 }144 self._test_request_helper(filters, expected)145 def test_request_with_alt_auth_cleans_alt(self):146 self.auth_provider.set_alt_auth_data(147 'body',148 (fake_identity.ALT_TOKEN, self._get_fake_alt_identity()))149 self.test_request()150 # Assert alt auth data is clear after it151 self.assertIsNone(self.auth_provider.alt_part)152 self.assertIsNone(self.auth_provider.alt_auth_data)153 def test_request_with_alt_part_without_alt_data(self):154 """155 Assert that when alt_part is defined, the corresponding original156 request element is kept the same.157 """158 filters = {...

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