Best Python code snippet using tempest_python
test_cleanup_services.py
Source:test_cleanup_services.py
...179 project_id='b8e3ece07bb049138d224436756e3b57',180 data={},181 saved_state_json=self.saved_state182 )183 def _test_delete(self, mocked_fixture_tuple_list, fail=False):184 serv = self._create_cmd_service(self.service_class)185 resp, fixtures = self.run_function_with_mocks(186 serv.run,187 mocked_fixture_tuple_list,188 )189 for fixture in fixtures:190 if fixture.mock.return_value == 'validate':191 fixture.mock.assert_called()192 elif fail is False and fixture.mock.return_value == 'exception':193 fixture.mock.assert_not_called()194 elif self.service_name in self.saved_state.keys():195 fixture.mock.assert_called_once()196 for key in self.saved_state[self.service_name].keys():197 self.assertNotIn(key, fixture.mock.call_args[0][0])198 else:199 fixture.mock.assert_called_once()200 self.assertFalse(serv.data)201 def _test_dry_run_true(self, mocked_fixture_tuple_list):202 serv = self._create_cmd_service(self.service_class, is_dry_run=True)203 _, fixtures = self.run_function_with_mocks(204 serv.run,205 mocked_fixture_tuple_list206 )207 for fixture in fixtures:208 if fixture.mock.return_value == 'delete':209 fixture.mock.assert_not_called()210 elif self.service_name in self.saved_state.keys():211 fixture.mock.assert_called_once()212 for key in self.saved_state[self.service_name].keys():213 self.assertNotIn(key, fixture.mock.call_args[0][0])214 else:215 fixture.mock.assert_called_once()216 def _test_saved_state_true(self, mocked_fixture_tuple_list):217 serv = self._create_cmd_service(self.service_class, is_save_state=True)218 _, fixtures = self.run_function_with_mocks(219 serv.run,220 mocked_fixture_tuple_list221 )222 for item in self.response[self.service_name]:223 self.assertIn(item['id'],224 serv.data[self.service_name])225 for fixture in fixtures:226 fixture.mock.assert_called_once()227 def _test_is_preserve_true(self, mocked_fixture_tuple_list):228 serv = self._create_cmd_service(self.service_class, is_preserve=True)229 resp, fixtures = self.run_function_with_mocks(230 serv.list,231 mocked_fixture_tuple_list232 )233 for fixture in fixtures:234 fixture.mock.assert_called_once()235 self.assertIn(resp[0], self.response[self.service_name])236 for rsp in resp:237 self.assertNotIn(rsp['id'], self.conf_values.values())238 self.assertNotIn(rsp['name'], self.conf_values.values())239class TestSnapshotService(BaseCmdServiceTests):240 service_class = 'SnapshotService'241 service_name = 'snapshots'242 response = {243 "snapshots": [244 {245 "status": "available",246 "metadata": {247 "name": "test"248 },249 "name": "test-volume-snapshot",250 "volume_id": "173f7b48-c4c1-4e70-9acc-086b39073506",251 "created_at": "2015-11-29T02:25:51.000000",252 "size": 1,253 "updated_at": "2015-11-20T05:36:40.000000",254 "id": "b1323cda-8e4b-41c1-afc5-2fc791809c8c",255 "description": "volume snapshot"256 },257 {258 "status": "available",259 "name": "saved-snapshot",260 "metadata": {},261 "id": "1ad4c789-7e8w-4dwg-afc5",262 "size": 1,263 "volume_id": "af7c41be-1ff6-4233-a690-7ed61c34347f",264 "created_at": "2015-11-20T05:39:40.000000",265 "updated_at": "2015-11-20T05:39:40.000000",266 "description": "snapshot in saved state"267 }268 ]269 }270 def test_delete_fail(self):271 delete_mock = [(self.get_method, self.response, 200),272 (self.delete_method, 'error', None),273 (self.log_method, 'exception', None)]274 self._test_delete(delete_mock, fail=True)275 def test_delete_pass(self):276 delete_mock = [(self.get_method, self.response, 200),277 (self.delete_method, None, 202),278 (self.log_method, 'exception', None)]279 self._test_delete(delete_mock)280 def test_dry_run(self):281 dry_mock = [(self.get_method, self.response, 200),282 (self.delete_method, "delete", None)]283 self._test_dry_run_true(dry_mock)284 def test_save_state(self):285 self._test_saved_state_true([(self.get_method, self.response, 200)])286class TestServerService(BaseCmdServiceTests):287 service_class = 'ServerService'288 service_name = 'servers'289 response = {290 "servers": [291 {292 "id": "22c91117-08de-4894-9aa9-6ef382400985",293 "links": [294 {295 "href": "http://openstack.example.com/v2/6f70-6ef0985",296 "rel": "self"297 },298 {299 "href": "http://openstack.example.com/6f70656e7-6ef35",300 "rel": "bookmark"301 }302 ],303 "name": "new-server-test"304 },305 {306 "id": "7a6d4v7w-36ds-4216",307 "links": [308 {309 "href": "http://openstack.example.com/v2/6f70-6ef0985",310 "rel": "self"311 },312 {313 "href": "http://openstack.example.com/6f70656e7-6ef35",314 "rel": "bookmark"315 }316 ],317 "name": "saved-server"318 }319 ]320 }321 def test_delete_fail(self):322 delete_mock = [(self.get_method, self.response, 200),323 (self.delete_method, 'error', None),324 (self.log_method, 'exception', None)]325 self._test_delete(delete_mock, fail=True)326 def test_delete_pass(self):327 delete_mock = [(self.get_method, self.response, 200),328 (self.delete_method, None, 204),329 (self.log_method, 'exception', None)]330 self._test_delete(delete_mock)331 def test_dry_run(self):332 dry_mock = [(self.get_method, self.response, 200),333 (self.delete_method, "delete", None)]334 self._test_dry_run_true(dry_mock)335 def test_save_state(self):336 self._test_saved_state_true([(self.get_method, self.response, 200)])337class TestServerGroupService(BaseCmdServiceTests):338 service_class = 'ServerGroupService'339 service_name = 'server_groups'340 validate_response = ('tempest.lib.services.compute.server_groups_client'341 '.ServerGroupsClient.validate_response')342 response = {343 "server_groups": [344 {345 "id": "616fb98f-46ca-475e-917e-2563e5a8cd19",346 "name": "test",347 "policy": "anti-affinity",348 "rules": {"max_server_per_host": 3},349 "members": [],350 "project_id": "6f70656e737461636b20342065766572",351 "user_id": "fake"352 },353 {354 "id": "as6d5f7g-46ca-475e",355 "name": "saved-server-group"356 }357 ]358 }359 def test_delete_fail(self):360 delete_mock = [(self.get_method, self.response, 200),361 (self.validate_response, 'validate', None),362 (self.delete_method, 'error', None),363 (self.log_method, 'exception', None)]364 self._test_delete(delete_mock, fail=True)365 def test_delete_pass(self):366 delete_mock = [(self.get_method, self.response, 200),367 (self.validate_response, 'validate', None),368 (self.delete_method, None, 204),369 (self.log_method, 'exception', None)]370 self._test_delete(delete_mock)371 def test_dry_run(self):372 dry_mock = [(self.get_method, self.response, 200),373 (self.validate_response, 'validate', None),374 (self.delete_method, "delete", None)]375 self._test_dry_run_true(dry_mock)376 def test_save_state(self):377 self._test_saved_state_true([(self.get_method, self.response, 200),378 (self.validate_response, 'validate', None)379 ])380class TestKeyPairService(BaseCmdServiceTests):381 service_class = 'KeyPairService'382 service_name = 'keypairs'383 validate_response = ('tempest.lib.services.compute.keypairs_client'384 '.KeyPairsClient.validate_response')385 response = {386 "keypairs": [387 {388 "keypair": {389 "fingerprint": "7e:eb:ab:24:ba:d1:e1:88:ae:9a:fb:66:53:bd",390 "name": "keypair-5d935425-31d5-48a7-a0f1-e76e9813f2c3",391 "type": "ssh",392 "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCkF\n"393 }394 },395 {396 "keypair": {397 "fingerprint": "7e:eb:ab:24",398 "name": "saved-key-pair"399 }400 }401 ]402 }403 def _test_saved_state_true(self, mocked_fixture_tuple_list):404 serv = self._create_cmd_service(self.service_class, is_save_state=True)405 _, fixtures = self.run_function_with_mocks(406 serv.run,407 mocked_fixture_tuple_list408 )409 for item in self.response[self.service_name]:410 self.assertTrue(item['keypair']['name'],411 serv.data[self.service_name])412 for fixture in fixtures:413 fixture.mock.assert_called_once()414 def test_delete_fail(self):415 delete_mock = [(self.get_method, self.response, 200),416 (self.validate_response, 'validate', None),417 (self.delete_method, 'error', None),418 (self.log_method, 'exception', None)]419 self._test_delete(delete_mock, fail=True)420 def test_delete_pass(self):421 delete_mock = [(self.get_method, self.response, 200),422 (self.validate_response, 'validate', None),423 (self.delete_method, None, 204),424 (self.log_method, 'exception', None)]425 self._test_delete(delete_mock)426 def test_dry_run(self):427 dry_mock = [(self.get_method, self.response, 200),428 (self.validate_response, 'validate', None),429 (self.delete_method, "delete", None)]430 self._test_dry_run_true(dry_mock)431 def test_save_state(self):432 self._test_saved_state_true([433 (self.get_method, self.response, 200),434 (self.validate_response, 'validate', None)435 ])436class TestVolumeService(BaseCmdServiceTests):437 service_class = 'VolumeService'438 service_name = 'volumes'439 response = {440 "volumes": [441 {442 "id": "efa54464-8fab-47cd-a05a-be3e6b396188",443 "links": [444 {445 "href": "http://127.0.0.1:37097/v3/89af/volumes/efa54",446 "rel": "self"447 },448 {449 "href": "http://127.0.0.1:37097/89af/volumes/efa54464",450 "rel": "bookmark"451 }452 ],453 "name": "volume-name"454 },455 {456 "id": "aa77asdf-1234",457 "name": "saved-volume",458 "links": [],459 }460 ]461 }462 def test_delete_fail(self):463 delete_mock = [(self.get_method, self.response, 200),464 (self.delete_method, 'error', None),465 (self.log_method, 'exception', None)]466 self._test_delete(delete_mock, fail=True)467 def test_delete_pass(self):468 delete_mock = [(self.get_method, self.response, 200),469 (self.delete_method, None, 202),470 (self.log_method, 'exception', None)]471 self._test_delete(delete_mock)472 def test_dry_run(self):473 dry_mock = [(self.get_method, self.response, 200),474 (self.delete_method, "delete", None)]475 self._test_dry_run_true(dry_mock)476 def test_save_state(self):477 self._test_saved_state_true([(self.get_method, self.response, 200)])478class TestVolumeQuotaService(BaseCmdServiceTests):479 service_class = 'VolumeQuotaService'480 service_name = 'volume_quota_service'481 response = {482 "quota_set": {483 "groups":484 {"reserved": 0, "limit": 10, "in_use": 0},485 "per_volume_gigabytes":486 {"reserved": 0, "limit": -1, "in_use": 0},487 "volumes":488 {"reserved": 0, "limit": 10, "in_use": 0},489 "gigabytes":490 {"reserved": 0, "limit": 1000, "in_use": 0},491 "backup_gigabytes":492 {"reserved": 0, "limit": 1000, "in_use": 0},493 "snapshots":494 {"reserved": 0, "limit": 10, "in_use": 0},495 "volumes_iscsi":496 {"reserved": 0, "limit": -1, "in_use": 0},497 "snapshots_iscsi":498 {"reserved": 0, "limit": -1, "in_use": 0},499 "backups":500 {"reserved": 0, "limit": 10, "in_use": 0},501 "gigabytes_iscsi":502 {"reserved": 0, "limit": -1, "in_use": 0},503 "id": "b8e3ece07bb049138d224436756e3b57"504 }505 }506 def test_delete_fail(self):507 delete_mock = [(self.delete_method, 'error', None),508 (self.log_method, 'exception', None)]509 self._test_delete(delete_mock, fail=True)510 def test_delete_pass(self):511 delete_mock = [(self.delete_method, None, 200),512 (self.log_method, 'exception', None)]513 self._test_delete(delete_mock)514 def test_dry_run(self):515 dry_mock = [(self.get_method, self.response, 200),516 (self.delete_method, "delete", None)]517 self._test_dry_run_true(dry_mock)518class TestNovaQuotaService(BaseCmdServiceTests):519 service_class = 'NovaQuotaService'520 service_name = 'nova_quota_service'521 response = {522 "limits": {523 "rate": [],524 "absolute": {525 "maxServerMeta": 128,526 "maxPersonality": 5,527 "totalServerGroupsUsed": 0,528 "maxImageMeta": 128,529 "maxPersonalitySize": 10240,530 "maxTotalKeypairs": 100,531 "maxSecurityGroupRules": 20,532 "maxServerGroups": 10,533 "totalCoresUsed": 0,534 "totalRAMUsed": 0,535 "totalInstancesUsed": 0,536 "maxSecurityGroups": 10,537 "totalFloatingIpsUsed": 0,538 "maxTotalCores": 20,539 "maxServerGroupMembers": 10,540 "maxTotalFloatingIps": 10,541 "totalSecurityGroupsUsed": 0,542 "maxTotalInstances": 10,543 "maxTotalRAMSize": 51200544 }545 }546 }547 def test_delete_fail(self):548 delete_mock = [(self.delete_method, 'error', None),549 (self.log_method, 'exception', None)]550 self._test_delete(delete_mock, fail=True)551 def test_delete_pass(self):552 delete_mock = [(self.delete_method, None, 202),553 (self.log_method, 'exception', None)]554 self._test_delete(delete_mock)555 def test_dry_run(self):556 dry_mock = [(self.get_method, self.response, 200),557 (self.delete_method, "delete", None)]558 self._test_dry_run_true(dry_mock)559class TestNetworkQuotaService(BaseCmdServiceTests):560 service_class = 'NetworkQuotaService'561 service_name = 'network_quota_service'562 response = {563 "quotas": [{564 "subnet": 110,565 "network": 100,566 "floatingip": 50,567 "tenant_id": "81e8490db559474dacb2212fca9cca2d",568 "subnetpool": -1,569 "security_group_rule": 100,570 "trunk": -1,571 "security_group": 10,572 "router": 10,573 "rbac_policy": 10, "project_id":574 "81e8490db559474dacb2212fca9cca2d", "port": 500575 }]576 }577 def test_delete_fail(self):578 delete_mock = [(self.delete_method, 'error', None),579 (self.log_method, 'exception', None)]580 self._test_delete(delete_mock, fail=True)581 def test_delete_pass(self):582 delete_mock = [(self.delete_method, None, 204),583 (self.log_method, 'exception', None)]584 self._test_delete(delete_mock)585 def test_dry_run(self):586 dry_mock = [(self.get_method, self.response, 200),587 (self.delete_method, "delete", None)]588 self._test_dry_run_true(dry_mock)589# Begin network service classes590class TestNetworkService(BaseCmdServiceTests):591 service_class = 'NetworkService'592 service_name = 'networks'593 response = {594 "networks": [595 {596 "admin_state_up": True,597 "availability_zone_hints": [],598 "availability_zones": [599 "nova"600 ],601 "created_at": "2016-03-08T20:19:41",602 "dns_domain": "my-domain.org.",603 "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",604 "l2_adjacency": False,605 "mtu": 1500,606 "name": "net1",607 "port_security_enabled": True,608 "project_id": "4fd44f30292945e481c7b8a0c8908869",609 "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",610 "revision_number": 1,611 "router:external": False,612 "shared": False,613 "status": "ACTIVE",614 "subnets": [615 "54d6f61d-db07-451c-9ab3-b9609b6b6f0b"616 ],617 "tenant_id": "4fd44f30292945e481c7b8a0c8908869",618 "updated_at": "2016-03-08T20:19:41",619 "vlan_transparent": True,620 "description": "",621 "is_default": False622 },623 {624 "id": "6722fc13-4319",625 "name": "saved-network"626 }627 ]628 }629 def test_delete_fail(self):630 delete_mock = [(self.get_method, self.response, 200),631 (self.delete_method, 'error', None),632 (self.log_method, 'exception', None)]633 self._test_delete(delete_mock, fail=True)634 def test_delete_pass(self):635 delete_mock = [(self.get_method, self.response, 200),636 (self.delete_method, None, 204),637 (self.log_method, 'exception', None)]638 self._test_delete(delete_mock)639 def test_dry_run(self):640 dry_mock = [(self.get_method, self.response, 200),641 (self.delete_method, "delete", None)]642 self._test_dry_run_true(dry_mock)643 def test_save_state(self):644 self._test_saved_state_true([(self.get_method, self.response, 200)])645 def test_preserve_list(self):646 self.response['networks'].append(647 {648 "admin_state_up": True,649 "availability_zone_hints": [],650 "availability_zones": [651 "nova"652 ],653 "created_at": "2017-03-08T20:19:41",654 "dns_domain": "my-domain.org.",655 "id": cleanup_service.CONF_PUB_NETWORK,656 "name": "net2",657 "port_security_enabled": True,658 "project_id": "4fd44f30292945e481c7b8a0c8908869",659 "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",660 "revision_number": 1,661 "status": "ACTIVE",662 "subnets": [663 "54d6f61d-db07-451c-9ab3-b9609b6b6f0b"664 ],665 "tenant_id": "4fd44f30292945e481c7b8a0c8908869",666 "updated_at": "2018-03-08T20:19:41",667 "vlan_transparent": True,668 "is_default": False669 })670 self._test_is_preserve_true([(self.get_method, self.response, 200)])671class TestNetworkFloatingIpService(BaseCmdServiceTests):672 service_class = 'NetworkFloatingIpService'673 service_name = 'floatingips'674 response = {675 "floatingips": [676 {677 "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f",678 "description": "for test",679 "dns_domain": "my-domain.org.",680 "dns_name": "myfip",681 "created_at": "2016-12-21T10:55:50Z",682 "updated_at": "2016-12-21T10:55:53Z",683 "revision_number": 1,684 "project_id": "4969c491a3c74ee4af974e6d800c62de",685 "tenant_id": "4969c491a3c74ee4af974e6d800c62de",686 "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57",687 "fixed_ip_address": "10.0.0.3",688 "floating_ip_address": "172.24.4.228",689 "port_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab",690 "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7",691 "status": "ACTIVE",692 "port_details": {693 "status": "ACTIVE",694 "name": "",695 "admin_state_up": True,696 "network_id": "02dd8479-ef26-4398-a102-d19d0a7b3a1f",697 "device_owner": "compute:nova",698 "mac_address": "fa:16:3e:b1:3b:30",699 "device_id": "8e3941b4-a6e9-499f-a1ac-2a4662025cba"700 },701 "tags": ["tag1,tag2"],702 "port_forwardings": []703 },704 {705 "id": "9e82d248-408a",706 "status": "ACTIVE"707 }708 ]709 }710 def test_delete_fail(self):711 delete_mock = [(self.get_method, self.response, 200),712 (self.delete_method, 'error', None),713 (self.log_method, 'exception', None)]714 self._test_delete(delete_mock, fail=True)715 def test_delete_pass(self):716 delete_mock = [(self.get_method, self.response, 200),717 (self.delete_method, None, 204),718 (self.log_method, 'exception', None)]719 self._test_delete(delete_mock)720 def test_dry_run(self):721 dry_mock = [(self.get_method, self.response, 200),722 (self.delete_method, "delete", None)]723 self._test_dry_run_true(dry_mock)724 def test_save_state(self):725 self._test_saved_state_true([(self.get_method, self.response, 200)])726class TestNetworkRouterService(BaseCmdServiceTests):727 service_class = 'NetworkRouterService'728 service_name = 'routers'729 validate_response = ('tempest.lib.services.network.routers_client'730 '.RoutersClient.validate_response')731 response = {732 "routers": [733 {734 "admin_state_up": True,735 "availability_zone_hints": [],736 "availability_zones": [737 "nova"738 ],739 "created_at": "2018-03-19T19:17:04Z",740 "description": "",741 "distributed": False,742 "external_gateway_info": {743 "enable_snat": True,744 "external_fixed_ips": [745 {746 "ip_address": "172.24.4.3",747 "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf"748 },749 {750 "ip_address": "2001:db8::c",751 "subnet_id": "0c56df5d-ace5-46c8-8f4c-45fa4e334d18"752 }753 ],754 "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3"755 },756 "flavor_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0",757 "ha": False,758 "id": "915a14a6-867b-4af7-83d1-70efceb146f9",759 "name": "router2",760 "revision_number": 1,761 "routes": [762 {763 "destination": "179.24.1.0/24",764 "nexthop": "172.24.3.99"765 }766 ],767 "status": "ACTIVE",768 "updated_at": "2018-03-19T19:17:22Z",769 "project_id": "0bd18306d801447bb457a46252d82d13",770 "tenant_id": "0bd18306d801447bb457a46252d82d13",771 "tags": ["tag1,tag2"]772 },773 {774 "id": "4s5w34hj-id44",775 "name": "saved-router"776 }777 ],778 # "ports" key is added to the response in order to simplify unit779 # testing - it's because NetworkRouterService's delete method lists780 # ports before deleting any router781 "ports": []782 }783 def _test_delete(self, mocked_fixture_tuple_list, fail=False):784 serv = self._create_cmd_service(self.service_class)785 resp, fixtures = self.run_function_with_mocks(786 serv.run,787 mocked_fixture_tuple_list,788 )789 for fixture in fixtures:790 if fail is False and fixture.mock.return_value == 'exception':791 fixture.mock.assert_not_called()792 elif self.service_name in self.saved_state.keys():793 fixture.mock.assert_called()794 for key in self.saved_state[self.service_name].keys():795 self.assertNotIn(key, fixture.mock.call_args[0][0])796 self.assertFalse(serv.data)797 def test_delete_fail(self):798 delete_mock = [(self.get_method, self.response, 200),799 (self.delete_method, 'error', None),800 (self.log_method, 'exception', None)]801 self._test_delete(delete_mock, fail=True)802 def test_delete_pass(self):803 delete_mock = [(self.get_method, self.response, 200),804 (self.delete_method, None, 204),805 (self.log_method, 'exception', None)]806 self._test_delete(delete_mock)807 def test_dry_run(self):808 dry_mock = [(self.get_method, self.response, 200),809 (self.delete_method, "delete", None)]810 self._test_dry_run_true(dry_mock)811 def test_save_state(self):812 self._test_saved_state_true([(self.get_method, self.response, 200)])813 def test_preserve_list(self):814 self.response['routers'].append(815 {816 "admin_state_up": True,817 "availability_zone_hints": [],818 "availability_zones": [819 "nova"820 ],821 "created_at": "2018-03-19T19:17:04Z",822 "id": cleanup_service.CONF_PUB_ROUTER,823 "name": "router-preserve",824 "status": "ACTIVE",825 "updated_at": "2018-03-19T19:17:22Z",826 "project_id": "0bd18306d801447bb457a46252d82d13",827 "tenant_id": "0bd18306d801447bb457a46252d82d13",828 "tags": ["tag1,tag2"]829 })830 self._test_is_preserve_true([(self.get_method, self.response, 200)])831class TestNetworkMeteringLabelRuleService(BaseCmdServiceTests):832 service_class = 'NetworkMeteringLabelRuleService'833 service_name = 'metering_label_rules'834 response = {835 "metering_label_rules": [836 {837 "remote_ip_prefix": "20.0.0.0/24",838 "direction": "ingress",839 "metering_label_id": "e131d186-b02d-4c0b-83d5-0c0725c4f812",840 "id": "9536641a-7d14-4dc5-afaf-93a973ce0eb8",841 "excluded": False842 },843 {844 "direction": "ingress",845 "id": "93a973ce-4dc5"846 }847 ]848 }849 def test_delete_fail(self):850 delete_mock = [(self.get_method, self.response, 200),851 (self.delete_method, 'error', None),852 (self.log_method, 'exception', None)]853 self._test_delete(delete_mock, fail=True)854 def test_delete_pass(self):855 delete_mock = [(self.get_method, self.response, 200),856 (self.delete_method, None, 204),857 (self.log_method, 'exception', None)]858 self._test_delete(delete_mock)859 def test_dry_run(self):860 dry_mock = [(self.get_method, self.response, 200),861 (self.delete_method, "delete", None)]862 self._test_dry_run_true(dry_mock)863 def test_save_state(self):864 self._test_saved_state_true([(self.get_method, self.response, 200)])865class TestNetworkMeteringLabelService(BaseCmdServiceTests):866 service_class = 'NetworkMeteringLabelService'867 service_name = 'metering_labels'868 response = {869 "metering_labels": [870 {871 "project_id": "45345b0ee1ea477fac0f541b2cb79cd4",872 "tenant_id": "45345b0ee1ea477fac0f541b2cb79cd4",873 "description": "label1 description",874 "name": "label1",875 "id": "a6700594-5b7a-4105-8bfe-723b346ce866",876 "shared": False877 },878 {879 "name": "saved-label",880 "id": "723b346ce866-4c7q",881 }882 ]883 }884 def test_delete_fail(self):885 delete_mock = [(self.get_method, self.response, 200),886 (self.delete_method, 'error', None),887 (self.log_method, 'exception', None)]888 self._test_delete(delete_mock, fail=True)889 def test_delete_pass(self):890 delete_mock = [(self.get_method, self.response, 200),891 (self.delete_method, None, 204),892 (self.log_method, 'exception', None)]893 self._test_delete(delete_mock)894 def test_dry_run(self):895 dry_mock = [(self.get_method, self.response, 200),896 (self.delete_method, "delete", None)]897 self._test_dry_run_true(dry_mock)898 def test_save_state(self):899 self._test_saved_state_true([(self.get_method, self.response, 200)])900class TestNetworkPortService(BaseCmdServiceTests):901 service_class = 'NetworkPortService'902 service_name = 'ports'903 response = {904 "ports": [905 {906 "admin_state_up": True,907 "allowed_address_pairs": [],908 "created_at": "2016-03-08T20:19:41",909 "description": "",910 "device_id": "9ae135f4-b6e0-4dad-9e91-3c223e385824",911 "device_owner": "",912 "dns_assignment": {913 "hostname": "myport",914 "ip_address": "172.24.4.2",915 "fqdn": "myport.my-domain.org"916 },917 "dns_domain": "my-domain.org.",918 "dns_name": "myport",919 "extra_dhcp_opts": [920 {921 "opt_value": "pxelinux.0",922 "ip_version": 4,923 "opt_name": "bootfile-name"924 }925 ],926 "fixed_ips": [927 {928 "ip_address": "172.24.4.2",929 "subnet_id": "008ba151-0b8c-4a67-98b5-0d2b87666062"930 }931 ],932 "id": "d80b1a3b-4fc1-49f3-952e-1e2ab7081d8b",933 "ip_allocation": "immediate",934 "mac_address": "fa:16:3e:58:42:ed",935 "name": "test_port",936 "network_id": "70c1db1f-b701-45bd-96e0-a313ee3430b3",937 "project_id": "",938 "revision_number": 1,939 "security_groups": [],940 "status": "ACTIVE",941 "tags": ["tag1,tag2"],942 "tenant_id": "",943 "updated_at": "2016-03-08T20:19:41",944 "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",945 "port_security_enabled": False946 },947 {948 "id": "aa74aa4v-741a",949 "name": "saved-port",950 "device_owner": ""951 }952 ]953 }954 def test_delete_fail(self):955 delete_mock = [(self.get_method, self.response, 200),956 (self.delete_method, 'error', None),957 (self.log_method, 'exception', None)]958 self._test_delete(delete_mock, fail=True)959 def test_delete_pass(self):960 delete_mock = [(self.get_method, self.response, 200),961 (self.delete_method, None, 204),962 (self.log_method, 'exception', None)]963 self._test_delete(delete_mock)964 def test_dry_run(self):965 dry_mock = [(self.get_method, self.response, 200),966 (self.delete_method, "delete", None)]967 self._test_dry_run_true(dry_mock)968 def test_save_state(self):969 self._test_saved_state_true([(self.get_method, self.response, 200)])970 def test_preserve_list(self):971 self.response['ports'].append(972 {973 "created_at": "2018-03-08T20:19:41",974 "description": "",975 "device_id": "9ae135f4-b6e0-4dad-9e91-3c223e385824",976 "device_owner": "compute:router_gateway",977 "id": "d80b1a3b-4fc1-49f3-952e-1fdy1ws542",978 "ip_allocation": "immediate",979 "mac_address": "fa:16:3e:58:42:ed",980 "name": "preserve_port",981 "network_id": cleanup_service.CONF_PUB_NETWORK,982 "project_id": "",983 "security_groups": [],984 "status": "ACTIVE",985 "tags": ["tag1,tag2"],986 "tenant_id": "",987 "updated_at": "2018-03-08T20:19:41",988 })989 self._test_is_preserve_true([(self.get_method, self.response, 200)])990class TestNetworkSecGroupService(BaseCmdServiceTests):991 service_class = 'NetworkSecGroupService'992 service_name = 'security_groups'993 response = {994 "security_groups": [995 {996 "description": "default",997 "id": "85cc3048-abc3-43cc-89b3-377341426ac5",998 "name": "test",999 "security_group_rules": [1000 {1001 "direction": "egress",1002 "ethertype": "IPv6",1003 "id": "3c0e45ff-adaf-4124-b083-bf390e5482ff",1004 "security_group_id": "85cc3048-abc3-43cc-89b3-3773414",1005 "project_id": "e4f50856753b4dc6afee5fa6b9b6c550",1006 "revision_number": 1,1007 "tags": ["tag1,tag2"],1008 "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",1009 "created_at": "2018-03-19T19:16:56Z",1010 "updated_at": "2018-03-19T19:16:56Z",1011 "description": ""1012 }1013 ]1014 },1015 {1016 "id": "7q844add-3697",1017 "name": "saved-sec-group"1018 }1019 ]1020 }1021 def test_delete_fail(self):1022 delete_mock = [(self.get_method, self.response, 200),1023 (self.delete_method, 'error', None),1024 (self.log_method, 'exception', None)]1025 self._test_delete(delete_mock, fail=True)1026 def test_delete_pass(self):1027 delete_mock = [(self.get_method, self.response, 200),1028 (self.delete_method, None, 204),1029 (self.log_method, 'exception', None)]1030 self._test_delete(delete_mock)1031 def test_dry_run(self):1032 dry_mock = [(self.get_method, self.response, 200),1033 (self.delete_method, "delete", None)]1034 self._test_dry_run_true(dry_mock)1035 def test_save_state(self):1036 self._test_saved_state_true([(self.get_method, self.response, 200)])1037 def test_preserve_list(self):1038 self.response['security_groups'].append(1039 {1040 "description": "default",1041 "id": "85cc3048-abc3-43cc-89b3-377341426ac5",1042 "name": "test",1043 "security_group_rules": [1044 {1045 "direction": "egress",1046 "ethertype": "IPv6",1047 "id": "3c0e45ff-adaf-4124-b083-bf390e5482ff",1048 "security_group_id": "85cc3048-abc3-43cc-89b3-3773414",1049 "project_id": cleanup_service.CONF_PROJECTS[0],1050 "revision_number": 1,1051 "tags": ["tag1,tag2"],1052 "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",1053 "created_at": "2018-03-19T19:16:56Z",1054 "updated_at": "2018-03-19T19:16:56Z",1055 "description": ""1056 }1057 ]1058 })1059 self._test_is_preserve_true([(self.get_method, self.response, 200)])1060class TestNetworkSubnetService(BaseCmdServiceTests):1061 service_class = 'NetworkSubnetService'1062 service_name = 'subnets'1063 response = {1064 "subnets": [1065 {1066 "name": "private-subnet",1067 "enable_dhcp": True,1068 "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",1069 "project_id": "26a7980765d0414dbc1fc1f88cdb7e6e",1070 "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",1071 "dns_nameservers": [],1072 "allocation_pools": [1073 {1074 "start": "10.0.0.2",1075 "end": "10.0.0.254"1076 }1077 ],1078 "host_routes": [],1079 "ip_version": 4,1080 "gateway_ip": "10.0.0.1",1081 "cidr": "10.0.0.0/24",1082 "id": "08eae331-0402-425a-923c-34f7cfe39c1b",1083 "created_at": "2016-10-10T14:35:34Z",1084 "revision_number": 2,1085 "service_types": [],1086 "tags": ["tag1,tag2"],1087 "updated_at": "2016-10-10T14:35:34Z"1088 },1089 {1090 "id": "55ttda4a-2584",1091 "name": "saved-subnet"1092 }1093 ]1094 }1095 def test_delete_fail(self):1096 delete_mock = [(self.get_method, self.response, 200),1097 (self.delete_method, 'error', None),1098 (self.log_method, 'exception', None)]1099 self._test_delete(delete_mock, fail=True)1100 def test_delete_pass(self):1101 delete_mock = [(self.get_method, self.response, 200),1102 (self.delete_method, None, 204),1103 (self.log_method, 'exception', None)]1104 self._test_delete(delete_mock)1105 def test_dry_run(self):1106 dry_mock = [(self.get_method, self.response, 200),1107 (self.delete_method, "delete", None)]1108 self._test_dry_run_true(dry_mock)1109 def test_save_state(self):1110 self._test_saved_state_true([(self.get_method, self.response, 200)])1111 def test_preserve_list(self):1112 self.response['subnets'].append(1113 {1114 "name": "public-subnet",1115 "network_id": cleanup_service.CONF_PUB_NETWORK,1116 "project_id": "26a7980765d0414dbc1fc1f88cdb7e6e",1117 "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",1118 "ip_version": 4,1119 "gateway_ip": "10.0.0.1",1120 "cidr": "10.0.0.0/24",1121 "id": "08eae331-0402-425a-923c-34f7cfe39c1b",1122 "created_at": "2018-10-10T14:35:34Z",1123 "service_types": [],1124 "tags": ["tag1,tag2"],1125 "updated_at": "2018-10-10T14:35:34Z"1126 })1127 self._test_is_preserve_true([(self.get_method, self.response, 200)])1128class TestNetworkSubnetPoolsService(BaseCmdServiceTests):1129 service_class = 'NetworkSubnetPoolsService'1130 service_name = 'subnetpools'1131 response = {1132 "subnetpools": [1133 {1134 "min_prefixlen": "64",1135 "default_prefixlen": "64",1136 "id": "03f761e6-eee0-43fc-a921-8acf64c14988",1137 "max_prefixlen": "64",1138 "name": "my-subnet-pool-ipv6",1139 "is_default": False,1140 "project_id": "9fadcee8aa7c40cdb2114fff7d569c08",1141 "tenant_id": "9fadcee8aa7c40cdb2114fff7d569c08",1142 "prefixes": [1143 "2001:db8:0:2::/64",1144 "2001:db8::/63"1145 ],1146 "ip_version": 6,1147 "shared": False,1148 "description": "",1149 "created_at": "2016-03-08T20:19:41",1150 "updated_at": "2016-03-08T20:19:41",1151 "revision_number": 2,1152 "tags": ["tag1,tag2"]1153 },1154 {1155 "id": "8acf64c1-43fc",1156 "name": "saved-subnet-pool"1157 }1158 ]1159 }1160 def test_delete_fail(self):1161 delete_mock = [(self.get_method, self.response, 200),1162 (self.delete_method, 'error', None),1163 (self.log_method, 'exception', None)]1164 self._test_delete(delete_mock, fail=True)1165 def test_delete_pass(self):1166 delete_mock = [(self.get_method, self.response, 200),1167 (self.delete_method, None, 204),1168 (self.log_method, 'exception', None)]1169 self._test_delete(delete_mock)1170 def test_dry_run(self):1171 dry_mock = [(self.get_method, self.response, 200),1172 (self.delete_method, "delete", None)]1173 self._test_dry_run_true(dry_mock)1174 def test_save_state(self):1175 self._test_saved_state_true([(self.get_method, self.response, 200)])1176 def test_preserve_list(self):1177 self.response['subnetpools'].append(1178 {1179 "min_prefixlen": "64",1180 "default_prefixlen": "64",1181 "id": "9acf64c1-43fc",1182 "name": "preserve-pool",1183 "project_id": cleanup_service.CONF_PROJECTS[0],1184 "created_at": "2016-03-08T20:19:41",1185 "updated_at": "2016-03-08T20:19:41"1186 })1187 self._test_is_preserve_true([(self.get_method, self.response, 200)])1188# begin global services1189class TestRegionService(BaseCmdServiceTests):1190 service_class = 'RegionService'1191 service_name = 'regions'1192 response = {1193 "regions": [{1194 "parent_region_id": None,1195 "id": "RegionOne",1196 "links": {1197 "self":1198 "http://10.0.145.61:5000/v3/regions/RegionOne"1199 },1200 "description": ""1201 },1202 {1203 "parent_region_id": None,1204 "id": "RegionTwo",1205 "links": {1206 "self":1207 "http://10.0.145.61:5000/v3/regions/RegionTwo"1208 },1209 "description": ""1210 }],1211 "links": {1212 "self":1213 "http://10.0.145.61:5000/v3/regions",1214 "next": None,1215 "previous": None1216 }1217 }1218 def test_delete_pass(self):1219 delete_mock = [(self.get_method, self.response, 200),1220 (self.delete_method, None, 204),1221 (self.log_method, "exception", None)]1222 self._test_delete(delete_mock)1223 def test_delete_fail(self):1224 delete_mock = [(self.get_method, self.response, 200),1225 (self.delete_method, 'error', None),1226 (self.log_method, "exception", None)]1227 self._test_delete(delete_mock, fail=True)1228 def test_dry_run(self):1229 dry_mock = [(self.get_method, self.response, 200),1230 (self.delete_method, "delete", None)]1231 self._test_dry_run_true(dry_mock)1232 def test_save_state(self):1233 self._test_saved_state_true([(self.get_method, self.response, 200)])1234class TestDomainService(BaseCmdServiceTests):1235 service_class = 'DomainService'1236 service_name = 'domains'1237 response = {1238 "domains": [1239 {1240 "description": "Destroy all humans",1241 "enabled": True,1242 "id": "5a75994a3",1243 "links": {1244 "self": "http://example.com/identity/v3/domains/5a75994a3"1245 },1246 "name": "Sky_net"1247 },1248 {1249 "description": "Owns users and tenants on Identity API",1250 "enabled": False,1251 "id": "default",1252 "links": {1253 "self": "http://example.com/identity/v3/domains/default"1254 },1255 "name": "Default"1256 }1257 ]1258 }1259 mock_update = ("tempest.lib.services.identity.v3."1260 "domains_client.DomainsClient.update_domain")1261 def test_delete_fail(self):1262 delete_mock = [(self.get_method, self.response, 200),1263 (self.delete_method, 'error', None),1264 (self.log_method, 'exception', None),1265 (self.mock_update, 'update', None)]1266 self._test_delete(delete_mock, fail=True)1267 def test_delete_pass(self):1268 delete_mock = [(self.get_method, self.response, 200),1269 (self.delete_method, None, 204),1270 (self.log_method, 'exception', None),1271 (self.mock_update, 'update', None)]1272 self._test_delete(delete_mock)1273 def test_dry_run(self):1274 dry_mock = [(self.get_method, self.response, 200),1275 (self.delete_method, "delete", None)]1276 self._test_dry_run_true(dry_mock)1277 def test_save_state(self):1278 self._test_saved_state_true([(self.get_method, self.response, 200)])1279class TestProjectsService(BaseCmdServiceTests):1280 service_class = 'ProjectService'1281 service_name = 'projects'1282 response = {1283 "projects": [1284 {1285 "is_domain": False,1286 "description": None,1287 "domain_id": "default",1288 "enabled": True,1289 "id": "f38ohgp93jj032",1290 "links": {1291 "self": "http://example.com/identity/v3/projects"1292 "/f38ohgp93jj032"1293 },1294 "name": "manhattan",1295 "parent_id": None1296 },1297 {1298 "is_domain": False,1299 "description": None,1300 "domain_id": "default",1301 "enabled": True,1302 "id": "098f89d3292ri4jf4",1303 "links": {1304 "self": "http://example.com/identity/v3/projects"1305 "/098f89d3292ri4jf4"1306 },1307 "name": "Apollo",1308 "parent_id": None1309 }1310 ]1311 }1312 def test_delete_fail(self):1313 delete_mock = [(self.get_method, self.response, 200),1314 (self.delete_method, 'error', None),1315 (self.log_method, 'exception', None)]1316 self._test_delete(delete_mock, fail=True)1317 def test_delete_pass(self):1318 delete_mock = [(self.get_method, self.response, 200),1319 (self.delete_method, None, 204),1320 (self.log_method, 'exception', None)]1321 self._test_delete(delete_mock)1322 def test_dry_run(self):1323 dry_mock = [(self.get_method, self.response, 200),1324 (self.delete_method, "delete", None)]1325 self._test_dry_run_true(dry_mock)1326 def test_save_state(self):1327 self._test_saved_state_true([(self.get_method, self.response, 200)])1328 def test_preserve_list(self):1329 self.response['projects'].append(1330 {1331 "is_domain": False,1332 "description": None,1333 "domain_id": "default",1334 "enabled": True,1335 "id": "r343q98h09f3092",1336 "links": {1337 "self": "http://example.com/identity/v3/projects"1338 "/r343q98h09f3092"1339 },1340 "name": cleanup_service.CONF_PROJECTS[0],1341 "parent_id": None1342 })1343 self._test_is_preserve_true([(self.get_method, self.response, 200)])1344class TestImagesService(BaseCmdServiceTests):1345 service_class = 'ImageService'1346 service_name = 'images'1347 response = {1348 "images": [1349 {1350 "status": "ACTIVE",1351 "name": "stratus-0.3.2-x86_64-disk",1352 "id": "34yhwr-4t3q",1353 "updated": "2014-11-03T16:40:10Z",1354 "links": [{1355 "href": "http://openstack.ex.com/v2/openstack/images/"1356 "34yhwr-4t3q",1357 "rel": "self"}],1358 "created": "2014-10-30T08:23:39Z",1359 "minDisk": 0,1360 "minRam": 0,1361 "progress": 0,1362 "metadata": {},1363 },1364 {1365 "status": "ACTIVE",1366 "name": "cirros-0.3.2-x86_64-disk",1367 "id": "1bea47ed-f6a9",1368 "updated": "2014-11-03T16:40:10Z",1369 "links": [{1370 "href": "http://openstack.ex.com/v2/openstack/images/"1371 "1bea47ed-f6a9",1372 "rel": "self"}],1373 "created": "2014-10-30T08:23:39Z",1374 "minDisk": 0,1375 "minRam": 0,1376 "progress": 0,1377 "metadata": {},1378 }1379 ]1380 }1381 def test_delete_fail(self):1382 delete_mock = [(self.get_method, self.response, 200),1383 (self.delete_method, 'error', None),1384 (self.log_method, 'exception', None)]1385 self._test_delete(delete_mock, fail=True)1386 def test_delete_pass(self):1387 delete_mock = [(self.get_method, self.response, 200),1388 (self.delete_method, None, 204),1389 (self.log_method, 'exception', None)]1390 self._test_delete(delete_mock)1391 def test_dry_run(self):1392 dry_mock = [(self.get_method, self.response, 200),1393 (self.delete_method, "delete", None)]1394 self._test_dry_run_true(dry_mock)1395 def test_save_state(self):1396 self._test_saved_state_true([(self.get_method, self.response, 200)])1397 def test_preserve_list(self):1398 self.response['images'].append(1399 {1400 "status": "ACTIVE",1401 "name": "cirros-0.3.2-x86_64-disk",1402 "id": cleanup_service.CONF_IMAGES[0],1403 "updated": "2014-11-03T16:40:10Z",1404 "links": [{1405 "href": "http://openstack.ex.com/v2/openstack/images/"1406 "None",1407 "rel": "self"}],1408 "created": "2014-10-30T08:23:39Z",1409 "minDisk": 0,1410 "minRam": 0,1411 "progress": 0,1412 "metadata": {},1413 })1414 self._test_is_preserve_true([(self.get_method, self.response, 200)])1415class TestFlavorService(BaseCmdServiceTests):1416 service_class = 'FlavorService'1417 service_name = 'flavors'1418 response = {1419 "flavors": [1420 {1421 "disk": 1,1422 "id": "42",1423 "links": [{1424 "href": "http://openstack.ex.com/v2/openstack/flavors/1",1425 "rel": "self"}, {1426 "href": "http://openstack.ex.com/openstack/flavors/1",1427 "rel": "bookmark"}],1428 "name": "m1.tiny",1429 "ram": 512,1430 "swap": 1,1431 "vcpus": 11432 },1433 {1434 "disk": 2,1435 "id": "13",1436 "links": [{1437 "href": "http://openstack.ex.com/v2/openstack/flavors/2",1438 "rel": "self"}, {1439 "href": "http://openstack.ex.com/openstack/flavors/2",1440 "rel": "bookmark"}],1441 "name": "m1.tiny",1442 "ram": 512,1443 "swap": 1,1444 "vcpus": 11445 }1446 ]1447 }1448 def test_delete_fail(self):1449 delete_mock = [(self.get_method, self.response, 200),1450 (self.delete_method, 'error', None),1451 (self.log_method, 'exception', None)]1452 self._test_delete(delete_mock, fail=True)1453 def test_delete_pass(self):1454 delete_mock = [(self.get_method, self.response, 200),1455 (self.delete_method, None, 202),1456 (self.log_method, 'exception', None)]1457 self._test_delete(delete_mock)1458 def test_dry_run(self):1459 dry_mock = [(self.get_method, self.response, 200),1460 (self.delete_method, "delete", None)]1461 self._test_dry_run_true(dry_mock)1462 def test_save_state(self):1463 self._test_saved_state_true([(self.get_method, self.response, 200)])1464 def test_preserve_list(self):1465 self.response['flavors'].append(1466 {1467 "disk": 3,1468 "id": cleanup_service.CONF_FLAVORS[0],1469 "links": [{1470 "href": "http://openstack.ex.com/v2/openstack/flavors/3",1471 "rel": "self"}, {1472 "href": "http://openstack.ex.com/openstack/flavors/3",1473 "rel": "bookmark"}],1474 "name": "m1.tiny",1475 "ram": 512,1476 "swap": 1,1477 "vcpus": 11478 })1479 self._test_is_preserve_true([(self.get_method, self.response, 200)])1480class TestRoleService(BaseCmdServiceTests):1481 service_class = 'RoleService'1482 service_name = 'roles'1483 response = {1484 "roles": [1485 {1486 "domain_id": "FakeDomain",1487 "id": "3efrt74r45hn",1488 "name": "president",1489 "links": {1490 "self": "http://ex.com/identity/v3/roles/3efrt74r45hn"1491 }1492 },1493 {1494 "domain_id": 'FakeDomain',1495 "id": "39ruo5sdk040",1496 "name": "vice-p",1497 "links": {1498 "self": "http://ex.com/identity/v3/roles/39ruo5sdk040"1499 }1500 }1501 ]1502 }1503 def test_delete_fail(self):1504 delete_mock = [(self.get_method, self.response, 200),1505 (self.delete_method, 'error', None),1506 (self.log_method, 'exception', None)]1507 self._test_delete(delete_mock, fail=True)1508 def test_delete_pass(self):1509 delete_mock = [(self.get_method, self.response, 200),1510 (self.delete_method, None, 204),1511 (self.log_method, 'exception', None)]1512 self._test_delete(delete_mock)1513 def test_dry_run(self):1514 dry_mock = [(self.get_method, self.response, 200),1515 (self.delete_method, "delete", None)]1516 self._test_dry_run_true(dry_mock)1517 def test_save_state(self):1518 self._test_saved_state_true([(self.get_method, self.response, 200)])1519class TestUserService(BaseCmdServiceTests):1520 service_class = 'UserService'1521 service_name = 'users'1522 response = {1523 "users": [1524 {1525 "domain_id": "TempestDomain",1526 "enabled": True,1527 "id": "e812fb332456423fdv1b1320121qwe2",1528 "links": {1529 "self": "http://example.com/identity/v3/users/"1530 "e812fb332456423fdv1b1320121qwe2",1531 },1532 "name": "Thunder",1533 "password_expires_at": "3102-11-06T15:32:17.000000",1534 },1535 {1536 "domain_id": "TempestDomain",1537 "enabled": True,1538 "id": "32rwef64245tgr20121qw324bgg",1539 "links": {1540 "self": "http://example.com/identity/v3/users/"1541 "32rwef64245tgr20121qw324bgg",1542 },1543 "name": "Lightning",1544 "password_expires_at": "1893-11-06T15:32:17.000000",1545 }1546 ]1547 }1548 def test_delete_fail(self):1549 delete_mock = [(self.get_method, self.response, 200),1550 (self.delete_method, 'error', None),1551 (self.log_method, 'exception', None)]1552 self._test_delete(delete_mock, fail=True)1553 def test_delete_pass(self):1554 delete_mock = [(self.get_method, self.response, 200),1555 (self.delete_method, None, 204),1556 (self.log_method, 'exception', None)]1557 self._test_delete(delete_mock)1558 def test_dry_run(self):1559 dry_mock = [(self.get_method, self.response, 200),1560 (self.delete_method, "delete", None)]1561 self._test_dry_run_true(dry_mock)1562 def test_save_state(self):1563 self._test_saved_state_true([(self.get_method, self.response, 200)])1564 def test_preserve_list(self):1565 self.response['users'].append(1566 {1567 "domain_id": "TempestDomain",1568 "enabled": True,1569 "id": "23ads5tg3rtrhe30121qwhyth",1570 "links": {1571 "self": "http://example.com/identity/v3/users/"...
test_client.py
Source:test_client.py
...111 except AttributeError:112 ids = [elt['id'] for elt in elts]113 self.assertEqual(self.IDS, ids)114 @httpretty.activate115 def _test_delete(self):116 self.stub_auth()117 self.stub_list()118 self.stub_delete()119 elts = self.resources.list()120 # List() must return an iterable121 res = itertools.islice(elts, 1).next()122 self.resources.delete(res) # Checks this doesn't raise an exception123class TestSwiftBase(TestResourcesBase):124 TEST_URL = client_fixtures.STORAGE_PUBLIC_ENDPOINT125class TestSwiftResources(TestSwiftBase):126 @httpretty.activate127 def test_list_containers(self):128 self.stub_url('GET', json=client_fixtures.STORAGE_CONTAINERS_LIST)129 swift = client.SwiftResources(self.session)130 conts = list(swift.list_containers())131 self.assertEqual(conts, client_fixtures.STORAGE_CONTAINERS)132class TestSwiftObjects(TestSwiftBase):133 def stub_list(self):134 self.stub_url('GET', json=client_fixtures.STORAGE_CONTAINERS_LIST)135 self.stub_url('GET', parts=[client_fixtures.STORAGE_CONTAINERS[0]],136 json=client_fixtures.STORAGE_OBJECTS_LIST_0),137 self.stub_url('GET', parts=[client_fixtures.STORAGE_CONTAINERS[1]],138 json=client_fixtures.STORAGE_OBJECTS_LIST_1)139 def stub_delete(self):140 for obj in client_fixtures.STORAGE_OBJECTS:141 self.stub_url('DELETE', parts=[obj['container'], obj['name']])142 def setUp(self):143 super(TestSwiftObjects, self).setUp()144 self.resources = client.SwiftObjects(self.session)145 @httpretty.activate146 def test_list(self):147 self.stub_list()148 objs = list(self.resources.list())149 self.assertEqual(client_fixtures.STORAGE_OBJECTS, objs)150 def test_delete(self):151 self._test_delete()152class TestSwiftContainers(TestSwiftBase):153 def stub_list(self):154 self.stub_url('GET', json=client_fixtures.STORAGE_CONTAINERS_LIST)155 def stub_delete(self):156 self.stub_url('DELETE', parts=[client_fixtures.STORAGE_CONTAINERS[0]])157 def setUp(self):158 super(TestSwiftContainers, self).setUp()159 self.resources = client.SwiftContainers(self.session)160 @httpretty.activate161 def test_list(self):162 self.stub_list()163 conts = list(self.resources.list())164 self.assertEqual(conts, client_fixtures.STORAGE_CONTAINERS)165 def test_delete(self):166 self._test_delete()167class TestCinderBase(TestResourcesBase):168 TEST_URL = client_fixtures.VOLUME_PUBLIC_ENDPOINT169class TestCinderSnapshots(TestCinderBase):170 IDS = client_fixtures.SNAPSHOTS_IDS171 def stub_list(self):172 self.stub_url('GET', parts=['snapshots', 'detail'],173 json=client_fixtures.SNAPSHOTS_LIST)174 def stub_delete(self):175 self.stub_url(176 'DELETE', parts=['snapshots', client_fixtures.SNAPSHOTS_IDS[0]])177 def setUp(self):178 super(TestCinderSnapshots, self).setUp()179 self.resources = client.CinderSnapshots(self.session)180 def test_list(self):181 self._test_list()182 def test_delete(self):183 self._test_delete()184class TestCinderVolumes(TestCinderBase):185 IDS = client_fixtures.VOLUMES_IDS186 def stub_list(self):187 self.stub_url('GET', parts=['volumes', 'detail'],188 json=client_fixtures.VOLUMES_LIST)189 def stub_delete(self):190 self.stub_url(191 'DELETE', parts=['volumes', client_fixtures.VOLUMES_IDS[0]])192 def setUp(self):193 super(TestCinderVolumes, self).setUp()194 self.resources = client.CinderVolumes(self.session)195 def test_list(self):196 self._test_list()197 def test_delete(self):198 self._test_delete()199class TestCinderBackups(TestCinderBase):200 IDS = client_fixtures.VOLUME_BACKUP_IDS201 def stub_list(self):202 self.stub_url('GET', parts=['backups', 'detail'],203 json=client_fixtures.VOLUME_BACKUPS_LIST)204 def stub_delete(self):205 self.stub_url(206 'DELETE', parts=['backups', self.IDS[0]])207 def setUp(self):208 super(TestCinderBackups, self).setUp()209 # Make sure tests work whatever version of cinderclient210 self.versionstring_bak = cinderclient.version_info.version_string211 cinderclient.version_info.version_string = lambda: '1.4.0'212 self.session.is_admin = True213 self.resources = client.CinderBackups(self.session)214 def tearDown(self):215 super(TestCinderBackups, self).tearDown()216 cinderclient.version_info.version_string = self.versionstring_bak217 def test_list(self):218 self._test_list()219 def test_delete(self):220 self._test_delete()221 def test_empty_list(self):222 self.stub_auth()223 versionstring_bak = cinderclient.version_info.version_string224 cinderclient.version_info.version_string = lambda: '1.1.1'225 self.assertEqual(self.resources.list(), [])226 cinderclient.version_info.version_string = versionstring_bak227class TestNeutronBase(TestResourcesBase):228 TEST_URL = client_fixtures.NETWORK_PUBLIC_ENDPOINT229 # Used both in TestNeutronRouters and TestNeutronInterfaces230 def stub_list_routers(self):231 self.stub_url(232 'GET',233 parts=[234 'v2.0',235 'routers.json?tenant_id=%s' % client_fixtures.PROJECT_ID236 ],237 json=client_fixtures.ROUTERS_LIST238 )239class TestNeutronRouters(TestNeutronBase):240 IDS = client_fixtures.ROUTERS_IDS241 def stub_list(self):242 self.stub_list_routers()243 def stub_delete(self):244 routid = client_fixtures.ROUTERS_IDS[0]245 self.stub_url('PUT', parts=['v2.0', 'routers', "%s.json" % routid],246 json=client_fixtures.ROUTER_CLEAR_GATEWAY)247 self.stub_url('DELETE', parts=['v2.0', 'routers', "%s.json" % routid],248 json={})249 def setUp(self):250 super(TestNeutronRouters, self).setUp()251 self.resources = client.NeutronRouters(self.session)252 def test_list(self):253 self._test_list()254 def test_delete(self):255 self._test_delete()256class TestNeutronInterfaces(TestNeutronBase):257 IDS = client_fixtures.PORTS_IDS258 def stub_list(self):259 self.stub_list_routers()260 self.stub_url('GET', parts=['v2.0', "ports.json?device_id={}".format(client_fixtures.ROUTERS_IDS[0])],261 json=client_fixtures.ROUTER0_PORTS)262 self.stub_url('GET', parts=['v2.0', "ports.json?device_id={}".format(client_fixtures.ROUTERS_IDS[1])],263 json=client_fixtures.ROUTER1_PORTS)264 def stub_delete(self):265 for rout_id in client_fixtures.ROUTERS_IDS:266 self.stub_url('PUT', parts=['v2.0', 'routers', rout_id,267 'remove_router_interface.json'],268 json=client_fixtures.REMOVE_ROUTER_INTERFACE)269 def setUp(self):270 super(TestNeutronInterfaces, self).setUp()271 self.resources = client.NeutronInterfaces(self.session)272 def test_list(self):273 self._test_list()274 def test_delete(self):275 self._test_delete()276class TestNeutronPorts(TestNeutronBase):277 IDS = [client_fixtures.UNBOUND_PORT_ID]278 def stub_list(self):279 self.stub_url(280 'GET',281 parts=[282 'v2.0',283 'ports.json?tenant_id=%s' % client_fixtures.PROJECT_ID284 ],285 json=client_fixtures.NEUTRON_PORTS)286 def stub_delete(self):287 port_id = client_fixtures.UNBOUND_PORT_ID288 self.stub_url('DELETE', parts=['v2.0', 'ports', "{}.json".format(port_id)],289 json={})290 def setUp(self):291 super(TestNeutronPorts, self).setUp()292 self.resources = client.NeutronPorts(self.session)293 def test_list(self):294 self._test_list()295 def test_delete(self):296 self._test_delete()297class TestNeutronNetworks(TestNeutronBase):298 IDS = client_fixtures.NETWORKS_IDS299 def stub_list(self):300 self.stub_url(301 'GET',302 parts=[303 'v2.0',304 'networks.json?tenant_id=%s' % client_fixtures.PROJECT_ID305 ],306 json=client_fixtures.NETWORKS_LIST307 )308 def stub_delete(self):309 for net_id in client_fixtures.NETWORKS_IDS:310 self.stub_url('DELETE', parts=['v2.0', 'networks',311 "{}.json".format(net_id)], json={})312 def setUp(self):313 super(TestNeutronNetworks, self).setUp()314 self.resources = client.NeutronNetworks(self.session)315 def test_list(self):316 self._test_list()317 def test_delete(self):318 self._test_delete()319class TestNeutronSecgroups(TestNeutronBase):320 IDS = client_fixtures.SECGROUPS_IDS321 def stub_list(self):322 self.stub_url(323 'GET',324 parts=[325 'v2.0',326 'security-groups.json?tenant_id=%s' % client_fixtures.PROJECT_ID327 ],328 json=client_fixtures.SECGROUPS_LIST)329 def stub_delete(self):330 for secgroup_id in client_fixtures.SECGROUPS_IDS:331 self.stub_url('DELETE', parts=['v2.0', 'security-groups',332 "{}.json".format(secgroup_id)], json={})333 def setUp(self):334 super(TestNeutronSecgroups, self).setUp()335 self.resources = client.NeutronSecgroups(self.session)336 def test_list(self):337 self._test_list()338 def test_delete(self):339 self._test_delete()340class TestNeutronFloatingIps(TestNeutronBase):341 IDS = client_fixtures.FLOATING_IPS_IDS342 def stub_list(self):343 self.stub_url(344 'GET',345 parts=[346 'v2.0',347 'floatingips.json?tenant_id=%s' % client_fixtures.PROJECT_ID348 ],349 json=client_fixtures.FLOATING_IPS_LIST)350 def stub_delete(self):351 ip_id = client_fixtures.FLOATING_IPS_IDS[0]352 self.stub_url('DELETE', parts=['v2.0', 'floatingips', "{}.json".format(ip_id)], json={})353 def setUp(self):354 super(TestNeutronFloatingIps, self).setUp()355 self.resources = client.NeutronFloatingIps(self.session)356 def test_list(self):357 self._test_list()358 def test_delete(self):359 self._test_delete()360class TestNeutronFireWallRule(TestNeutronBase):361 IDS = client_fixtures.FIREWALL_RULE_IDS362 def stub_list(self):363 self.stub_url(364 'GET',365 parts=[366 'v2.0',367 'fw/firewall_rules.json?tenant_id=%s' % client_fixtures.PROJECT_ID368 ],369 json=client_fixtures.FIREWALL_RULE_LIST)370 def stub_delete(self):371 firewall_rule_id = client_fixtures.FIREWALL_RULE_IDS[0]372 self.stub_url('DELETE', parts=['v2.0', 'fw/firewall_rules', "{}.json".format(firewall_rule_id)], json={})373 def setUp(self):374 super(TestNeutronFireWallRule, self).setUp()375 self.resources = client.NeutronFireWallRule(self.session)376 def test_list(self):377 self._test_list()378 def test_delete(self):379 self._test_delete()380class TestNeutronFireWallPolicy(TestNeutronBase):381 IDS = client_fixtures.FIREWALL_POLICY_IDS382 def stub_list(self):383 self.stub_url(384 'GET',385 parts=[386 'v2.0',387 'fw/firewall_policies.json?tenant_id=%s' % client_fixtures.PROJECT_ID388 ],389 json=client_fixtures.FIREWALL_POLICY_LIST)390 def stub_delete(self):391 firewall_policy_id = client_fixtures.FIREWALL_POLICY_IDS[0]392 self.stub_url('DELETE', parts=['v2.0', 'fw/firewall_policies', "{}.json".format(firewall_policy_id)], json={})393 def setUp(self):394 super(TestNeutronFireWallPolicy, self).setUp()395 self.resources = client.NeutronFireWallPolicy(self.session)396 def test_list(self):397 self._test_list()398 def test_delete(self):399 self._test_delete()400class TestNeutronFireWall(TestNeutronBase):401 IDS = client_fixtures.FIREWALL_IDS402 def stub_list(self):403 self.stub_url(404 'GET',405 parts=[406 'v2.0',407 'fw/firewalls.json?tenant_id=%s' % client_fixtures.PROJECT_ID408 ],409 json=client_fixtures.FIREWALL_LIST)410 def stub_delete(self):411 firewall_id = client_fixtures.FIREWALL_IDS[0]412 self.stub_url('DELETE', parts=['v2.0', 'fw/firewalls', "{}.json".format(firewall_id)], json={})413 def setUp(self):414 super(TestNeutronFireWall, self).setUp()415 self.resources = client.NeutronFireWall(self.session)416 def test_list(self):417 self._test_list()418 def test_delete(self):419 self._test_delete()420class TestNeutronMeteringLabel(TestNeutronBase):421 IDS = client_fixtures.METERING_LABEL_IDS422 def stub_list(self):423 self.stub_url(424 'GET',425 parts=[426 'v2.0',427 'metering/metering-labels.json?tenant_id=%s' % client_fixtures.PROJECT_ID428 ],429 json=client_fixtures.METERING_LABEL_LIST)430 def stub_delete(self):431 firewall_id = client_fixtures.METERING_LABEL_IDS[0]432 self.stub_url('DELETE', parts=['v2.0', 'metering/metering-labels', "{}.json".format(firewall_id)], json={})433 def setUp(self):434 super(TestNeutronMeteringLabel, self).setUp()435 self.resources = client.NeutronMeteringLabel(self.session)436 def test_list(self):437 self._test_list()438 def test_delete(self):439 self._test_delete()440class TestNeutronLbMembers(TestNeutronBase):441 IDS = client_fixtures.LBAAS_MEMBER_IDS442 def stub_list(self):443 self.stub_url(444 'GET',445 parts=[446 'v2.0',447 'lb/members.json?tenant_id=%s' % client_fixtures.PROJECT_ID448 ],449 json=client_fixtures.LBAAS_MEMBER_LIST)450 def stub_delete(self):451 lb_member_id = client_fixtures.LBAAS_MEMBER_IDS[0]452 self.stub_url('DELETE', parts=['v2.0', 'lb/members', "{}.json".format(lb_member_id)], json={})453 def setUp(self):454 super(TestNeutronLbMembers, self).setUp()455 self.resources = client.NeutronLbMembers(self.session)456 def test_list(self):457 self._test_list()458 def test_delete(self):459 self._test_delete()460class TestNeutronLbVip(TestNeutronBase):461 IDS = client_fixtures.LBAAS_VIP_IDS462 def stub_list(self):463 self.stub_url(464 'GET',465 parts=[466 'v2.0',467 'lb/vips.json?tenant_id=%s' % client_fixtures.PROJECT_ID468 ],469 json=client_fixtures.LBAAS_VIP_LIST)470 def stub_delete(self):471 lb_vip_id = client_fixtures.LBAAS_VIP_IDS[0]472 self.stub_url('DELETE', parts=['v2.0', 'lb/vips', "{}.json".format(lb_vip_id)], json={})473 def setUp(self):474 super(TestNeutronLbVip, self).setUp()475 self.resources = client.NeutronLbVip(self.session)476 def test_list(self):477 self._test_list()478 def test_delete(self):479 self._test_delete()480class TestNeutronLbHealthMonitor(TestNeutronBase):481 IDS = client_fixtures.LBAAS_HEALTHMONITOR_IDS482 def stub_list(self):483 self.stub_url(484 'GET',485 parts=[486 'v2.0',487 'lb/health_monitors.json?tenant_id=%s' % client_fixtures.PROJECT_ID488 ],489 json=client_fixtures.LBAAS_HEALTHMONITOR_LIST)490 def stub_delete(self):491 lb_healthmonitor_id = client_fixtures.LBAAS_HEALTHMONITOR_IDS[0]492 self.stub_url('DELETE', parts=['v2.0', 'lb/health_monitors', "{}.json".format(lb_healthmonitor_id)], json={})493 def setUp(self):494 super(TestNeutronLbHealthMonitor, self).setUp()495 self.resources = client.NeutronLbHealthMonitor(self.session)496 def test_list(self):497 self._test_list()498 def test_delete(self):499 self._test_delete()500class TestNeutronLbPool(TestNeutronBase):501 IDS = client_fixtures.LBAAS_POOL_IDS502 def stub_list(self):503 self.stub_url(504 'GET',505 parts=[506 'v2.0',507 'lb/pools.json?tenant_id=%s' % client_fixtures.PROJECT_ID508 ],509 json=client_fixtures.LBAAS_POOL_LIST)510 def stub_delete(self):511 lb_pool_id = client_fixtures.LBAAS_POOL_IDS[0]512 self.stub_url('DELETE', parts=['v2.0', 'lb/pools', "{}.json".format(lb_pool_id)], json={})513 def setUp(self):514 super(TestNeutronLbPool, self).setUp()515 self.resources = client.NeutronLbPool(self.session)516 def test_list(self):517 self._test_list()518 def test_delete(self):519 self._test_delete()520class TestNovaServers(TestResourcesBase):521 TEST_URL = client_fixtures.COMPUTE_PUBLIC_ENDPOINT522 IDS = client_fixtures.SERVERS_IDS523 def stub_list(self):524 self.stub_url('GET', parts=['servers', 'detail'],525 json=client_fixtures.SERVERS_LIST)526 def stub_delete(self):527 self.stub_url(528 'DELETE', parts=['servers', client_fixtures.SERVERS_IDS[0]])529 def setUp(self):530 super(TestNovaServers, self).setUp()531 self.resources = client.NovaServers(self.session)532 def test_list(self):533 self._test_list()534 def test_delete(self):535 self._test_delete()536class TestGlanceImages(TestResourcesBase):537 TEST_URL = client_fixtures.IMAGE_PUBLIC_ENDPOINT538 IDS = client_fixtures.IMAGES_IDS539 def stub_list(self):540 self.stub_url('GET', parts=['v1', 'images', 'detail'],541 json=client_fixtures.IMAGES_LIST)542 def stub_delete(self):543 self.stub_url(544 'DELETE', parts=['v1', 'images', client_fixtures.IMAGES_IDS[0]])545 def setUp(self):546 super(TestGlanceImages, self).setUp()547 self.resources = client.GlanceImages(self.session)548 def test_list(self):549 self._test_list()550 def test_delete(self):551 self._test_delete()552class TestCeilometerAlarms(TestResourcesBase):553 TEST_URL = client_fixtures.METERING_PUBLIC_ENDPOINT554 def extra_set_up(self):555 self.stub_url(556 'GET', base_url=AUTH_URL, json=client_fixtures.AUTH_URL_RESPONSE)557 self.resources = client.CeilometerAlarms(self.session)558 def stub_list(self):559 self.stub_url('GET', parts=['v2', 'alarms'],560 json=client_fixtures.ALARMS_LIST)561 def stub_delete(self):562 self.stub_url(563 'DELETE', parts=['v2', 'alarms', client_fixtures.ALARMS_IDS[0]])564 def setUp(self):565 super(TestCeilometerAlarms, self).setUp()566 @httpretty.activate567 def test_list(self):568 self.stub_auth()569 self.stub_list()570 elts = list(self.resources.list())571 ids = [elt.alarm_id for elt in elts]572 self.assertEqual(client_fixtures.ALARMS_IDS, ids)573 def test_delete(self):574 self._test_delete()575class TestHeatStacks(TestResourcesBase):576 TEST_URL = client_fixtures.ORCHESTRATION_PUBLIC_ENDPOINT577 IDS = client_fixtures.STACKS_IDS578 def stub_list(self):579 self.stub_url('GET', parts=['stacks?'],580 json=client_fixtures.STACKS_LIST)581 def stub_delete(self):582 self.stub_url(583 'DELETE', parts=['stacks', client_fixtures.STACKS_IDS[0]])584 def setUp(self):585 super(TestHeatStacks, self).setUp()586 self.resources = client.HeatStacks(self.session)587 def test_list(self):588 self._test_list()589 def test_delete(self):590 self._test_delete()591 @httpretty.activate592 def test_abandon(self):593 self.stub_auth()594 self.stub_list()595 get_result = {'stack': client_fixtures.STACKS_LIST['stacks'][1]}596 location = '%s/stacks/stack2/%s' % (self.TEST_URL,597 client_fixtures.STACKS_IDS[1])598 self.stub_url(599 'GET', parts=['stacks', client_fixtures.STACKS_IDS[1]],600 json=get_result, location=location)601 self.stub_url(602 'DELETE',603 parts=['stacks', 'stack2', client_fixtures.STACKS_IDS[1],604 'abandon'])...
test_handler_pool.py
Source:test_handler_pool.py
...45 pool = fake_objs.FakePool('TCP', 'ROUND_ROBIN')46 self.a.pool.update(None, old_pool, pool)47 self.print_mocks()48 self.a.last_client.slb.service_group.update.assert_called()49 def _test_delete(self, pool):50 self.a.pool.neutron.openstack_driver._member_count.return_value = 151 self.a.pool.delete(None, pool)52 self.print_mocks()53 def test_delete(self):54 pool = fake_objs.FakePool('TCP', 'LEAST_CONNECTIONS')55 pool.members = [fake_objs.FakeMember()]56 pool.health_monitors_status = [{'monitor_id': 'hm1', "pools": [pool]}]57 self.a.pool.neutron.openstack_driver._pool_get_hm.return_value = fake_objs.FakeHM()58 self._test_delete(pool)59 (self.a.last_client.slb.service_group.delete.60 assert_called_with(pool['id']))61 def test_delete_with_hm_dissociates_hm(self):62 pool = fake_objs.FakePool('TCP', 'LEAST_CONNECTIONS')63 hm = fake_objs.FakeHM("TCP")64 hm.pools.append(fake_objs.FakePool('TCP', 'LEAST_CONNECTIONS'))65 pool.members = [fake_objs.FakeMember()]66 pool.health_monitors_status = [{'monitor_id': 'hm1', "pools": [pool]}]67 self.a.pool.neutron.openstack_driver._pool_get_hm.return_value = hm68 self._test_delete(pool)69 self.a.last_client.slb.service_group.update.assert_called_with(70 "id1",71 health_monitor="",72 health_check_disable=True)73 def test_delete_without_health_monitor(self):74 pool = fake_objs.FakePool('TCP', 'LEAST_CONNECTIONS')75 pool.members = [fake_objs.FakeMember()]76 pool.health_monitors_status = []77 self._test_delete(pool)78 (self.a.last_client.slb.service_group.delete.79 assert_called_with(pool.id))80 def test_delete_removes_monitor(self):81 pool = fake_objs.FakePool('TCP', 'LEAST_CONNECTIONS')82 pool.members = [fake_objs.FakeMember()]83 pool.health_monitors_status = [{'monitor_id': "hm1"}]84 self._test_delete(pool)85 self.a.last_client.slb.hm.delete.assert_called()86 def test_stats(self):87 pool = fake_objs.FakePool('TCP', 'LEAST_CONNECTIONS')88 z = self.a.pool89 z.neutron.pool_get_tenant_id = lambda x, y: 'hello'90 z._get_vip_id = lambda x, y: '2.2.2.2'91 z.stats(None, pool.id)92 self.print_mocks()93 s = str(self.a.last_client.mock_calls)...
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!!