Best Python code snippet using tempest_python
test_base_compute_client.py
Source:test_base_compute_client.py
...61 schema_versions_info = [62 {'min': None, 'max': '2.1', 'schema': 'schemav21'},63 {'min': '2.2', 'max': '2.9', 'schema': 'schemav22'},64 {'min': '2.10', 'max': None, 'schema': 'schemav210'}]65 def return_selected_schema(self):66 return self.get_schema(self.schema_versions_info)67class TestSchemaVersionsNone(base.BaseComputeServiceTest):68 api_microversion = None69 expected_schema = 'schemav21'70 def setUp(self):71 super(TestSchemaVersionsNone, self).setUp()72 fake_auth = fake_auth_provider.FakeAuthProvider()73 self.client = DummyServiceClient1(fake_auth, 'compute', 'regionOne')74 self.client.api_microversion = self.api_microversion75 def test_schema(self):76 self.assertEqual(self.expected_schema,77 self.client.return_selected_schema())78class TestSchemaVersionsV21(TestSchemaVersionsNone):79 api_microversion = '2.1'80 expected_schema = 'schemav21'81class TestSchemaVersionsV22(TestSchemaVersionsNone):82 api_microversion = '2.2'83 expected_schema = 'schemav22'84class TestSchemaVersionsV25(TestSchemaVersionsNone):85 api_microversion = '2.5'86 expected_schema = 'schemav22'87class TestSchemaVersionsV29(TestSchemaVersionsNone):88 api_microversion = '2.9'89 expected_schema = 'schemav22'90class TestSchemaVersionsV210(TestSchemaVersionsNone):91 api_microversion = '2.10'92 expected_schema = 'schemav210'93class TestSchemaVersionsLatest(TestSchemaVersionsNone):94 api_microversion = 'latest'95 expected_schema = 'schemav210'96class DummyServiceClient2(base_compute_client.BaseComputeClient):97 schema_versions_info = [98 {'min': None, 'max': '2.1', 'schema': 'schemav21'},99 {'min': '2.2', 'max': '2.9', 'schema': 'schemav22'}]100 def return_selected_schema(self):101 return self.get_schema(self.schema_versions_info)102class TestSchemaVersionsNotFound(base.BaseComputeServiceTest):103 api_microversion = '2.10'104 expected_schema = 'schemav210'105 def setUp(self):106 super(TestSchemaVersionsNotFound, self).setUp()107 fake_auth = fake_auth_provider.FakeAuthProvider()108 self.client = DummyServiceClient2(fake_auth, 'compute', 'regionOne')109 self.client.api_microversion = self.api_microversion110 def test_schema(self):111 self.assertRaises(exceptions.JSONSchemaNotFound,...
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!!