Best Python code snippet using tempest_python
test_auth.py
Source:test_auth.py
...621 all_creds = fake_credentials.FakeKeystoneV3AllCredentials()622 self.auth_provider.credentials = all_creds623 auth_params = self.auth_provider._auth_params()624 self.assertNotIn('scope', auth_params.keys())625 for attr in all_creds.get_init_attributes():626 if attr.startswith('domain_'):627 self.assertNotIn(attr, auth_params.keys())628 else:629 self.assertIn(attr, auth_params.keys())630 self.assertEqual(getattr(all_creds, attr), auth_params[attr])631 def test_auth_parameters_with_project_scope(self):632 all_creds = fake_credentials.FakeKeystoneV3AllCredentials()633 self.auth_provider.credentials = all_creds634 self.auth_provider.scope = 'project'635 auth_params = self.auth_provider._auth_params()636 self.assertNotIn('scope', auth_params.keys())637 for attr in all_creds.get_init_attributes():638 if attr.startswith('domain_'):639 self.assertNotIn(attr, auth_params.keys())640 else:641 self.assertIn(attr, auth_params.keys())642 self.assertEqual(getattr(all_creds, attr), auth_params[attr])643 def test_auth_parameters_with_domain_scope(self):644 all_creds = fake_credentials.FakeKeystoneV3AllCredentials()645 self.auth_provider.credentials = all_creds646 self.auth_provider.scope = 'domain'647 auth_params = self.auth_provider._auth_params()648 self.assertNotIn('scope', auth_params.keys())649 for attr in all_creds.get_init_attributes():650 if attr.startswith('project_'):651 self.assertNotIn(attr, auth_params.keys())652 else:653 self.assertIn(attr, auth_params.keys())654 self.assertEqual(getattr(all_creds, attr), auth_params[attr])655 def test_auth_parameters_unscoped(self):656 all_creds = fake_credentials.FakeKeystoneV3AllCredentials()657 self.auth_provider.credentials = all_creds658 self.auth_provider.scope = 'unscoped'659 auth_params = self.auth_provider._auth_params()660 self.assertNotIn('scope', auth_params.keys())661 for attr in all_creds.get_init_attributes():662 if attr.startswith('project_') or attr.startswith('domain_'):663 self.assertNotIn(attr, auth_params.keys())664 else:665 self.assertIn(attr, auth_params.keys())666 self.assertEqual(getattr(all_creds, attr), auth_params[attr])667 def test_auth_parameters_with_system_scope(self):668 all_creds = fake_credentials.FakeKeystoneV3AllCredentials()669 self.auth_provider.credentials = all_creds670 self.auth_provider.scope = 'system'671 auth_params = self.auth_provider._auth_params()672 self.assertNotIn('scope', auth_params.keys())673 for attr in all_creds.get_init_attributes():674 if attr.startswith('project_') or attr.startswith('domain_'):675 self.assertNotIn(attr, auth_params.keys())676 else:677 self.assertIn(attr, auth_params.keys())678 self.assertEqual(getattr(all_creds, attr), auth_params[attr])679class TestKeystoneV3Credentials(base.TestCase):680 def testSetAttrUserDomain(self):681 creds = auth.KeystoneV3Credentials()682 creds.user_domain_name = 'user_domain'683 creds.domain_name = 'domain'684 self.assertEqual('user_domain', creds.user_domain_name)685 creds = auth.KeystoneV3Credentials()686 creds.domain_name = 'domain'687 creds.user_domain_name = 'user_domain'...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!