How to use create_group_from_source method in tempest

Best Python code snippet using tempest_python

test_groups_client.py

Source:test_groups_client.py Github

copy

Full Screen

1# Copyright (C) 2017 Dell Inc. or its subsidiaries.2#3# Licensed under the Apache License, Version 2.0 (the "License"); you may4# not use this file except in compliance with the License. You may obtain5# a copy of the License at6#7# http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the12# License for the specific language governing permissions and limitations13# under the License.14from tempest.lib.services.volume.v3 import groups_client15from tempest.tests.lib import fake_auth_provider16from tempest.tests.lib.services import base17class TestGroupsClient(base.BaseServiceTest):18 FAKE_CREATE_GROUP = {19 "group": {20 "id": "6f519a48-3183-46cf-a32f-41815f816666",21 "name": "first_group"22 }23 }24 FAKE_CREATE_GROUP_FROM_GROUP_SNAPSHOT = {25 "group": {26 "id": "6f519a48-3183-46cf-a32f-41815f816668",27 "name": "first_group"28 }29 }30 FAKE_CREATE_GROUP_FROM_GROUP = {31 "group": {32 "id": "6f519a48-3183-46cf-a32f-41815f816667",33 "name": "other_group"34 }35 }36 FAKE_UPDATE_GROUP = {37 "group": {38 "name": "new-group",39 "description": "New test group",40 "add_volumes": "27d45037-ade3-4a87-b729-dba3293c06f3,"41 "6e7cd916-d961-41cc-b3bd-0601ca0c701f",42 "remove_volumes": "4d580519-6467-448e-95e9-5b25c94d83c7,"43 "ea22464c-f095-4a87-a31f-c5d34e0c6fc9"44 }45 }46 FAKE_INFO_GROUP = {47 "group": {48 "id": "0e701ab8-1bec-4b9f-b026-a7ba4af13578",49 "name": "group-001",50 "description": "Test group 1",51 "group_type": "0e58433f-d108-4bf3-a22c-34e6b71ef86b",52 "volume_types": ["2103099d-7cc3-4e52-a2f1-23a5284416f3"],53 "status": "available",54 "availability_zone": "az1",55 "created_at": "20127-06-20T03:50:07Z"56 }57 }58 FAKE_LIST_GROUPS = {59 "groups": [60 {61 "id": "0e701ab8-1bec-4b9f-b026-a7ba4af13578",62 "name": "group-001",63 "description": "Test group 1",64 "group_type": "0e58433f-d108-4bf3-a22c-34e6b71ef86b",65 "volume_types": ["2103099d-7cc3-4e52-a2f1-23a5284416f3"],66 "status": "available",67 "availability_zone": "az1",68 "created_at": "2017-06-20T03:50:07Z",69 },70 {71 "id": "e479997c-650b-40a4-9dfe-77655818b0d2",72 "name": "group-002",73 "description": "Test group 2",74 "group_snapshot_id": "79c9afdb-7e46-4d71-9249-1f022886963c",75 "group_type": "0e58433f-d108-4bf3-a22c-34e6b71ef86b",76 "volume_types": ["2103099d-7cc3-4e52-a2f1-23a5284416f3"],77 "status": "available",78 "availability_zone": "az1",79 "created_at": "2017-06-19T01:52:47Z",80 },81 {82 "id": "c5c4769e-213c-40a6-a568-8e797bb691d4",83 "name": "group-003",84 "description": "Test group 3",85 "source_group_id": "e92f9dc7-0b20-492d-8ab2-3ad8fdac270e",86 "group_type": "0e58433f-d108-4bf3-a22c-34e6b71ef86b",87 "volume_types": ["2103099d-7cc3-4e52-a2f1-23a5284416f3"],88 "status": "available",89 "availability_zone": "az1",90 "created_at": "2017-06-18T06:34:32Z",91 }92 ]93 }94 def setUp(self):95 super(TestGroupsClient, self).setUp()96 fake_auth = fake_auth_provider.FakeAuthProvider()97 self.client = groups_client.GroupsClient(fake_auth,98 'volume',99 'regionOne')100 def _test_create_group(self, bytes_body=False):101 self.check_service_client_function(102 self.client.create_group,103 'tempest.lib.common.rest_client.RestClient.post',104 self.FAKE_CREATE_GROUP,105 bytes_body,106 status=202)107 def _test_show_group(self, bytes_body=False):108 self.check_service_client_function(109 self.client.show_group,110 'tempest.lib.common.rest_client.RestClient.get',111 self.FAKE_INFO_GROUP,112 bytes_body,113 group_id="3fbbcccf-d058-4502-8844-6feeffdf4cb5")114 def _test_list_groups(self, bytes_body=False):115 self.check_service_client_function(116 self.client.list_groups,117 'tempest.lib.common.rest_client.RestClient.get',118 self.FAKE_LIST_GROUPS,119 bytes_body,120 detail=True)121 def test_create_group_with_str_body(self):122 self._test_create_group()123 def test_create_group_with_bytes_body(self):124 self._test_create_group(bytes_body=True)125 def test_show_group_with_str_body(self):126 self._test_show_group()127 def test_show_group_with_bytes_body(self):128 self._test_show_group(bytes_body=True)129 def test_list_groups_with_str_body(self):130 self._test_list_groups()131 def test_list_groups_with_bytes_body(self):132 self._test_list_groups(bytes_body=True)133 def test_delete_group(self):134 self.check_service_client_function(135 self.client.delete_group,136 'tempest.lib.common.rest_client.RestClient.post',137 {},138 group_id='0e701ab8-1bec-4b9f-b026-a7ba4af13578',139 status=202)140 def test_create_group_from_group_snapshot(self):141 self.check_service_client_function(142 self.client.create_group_from_source,143 'tempest.lib.common.rest_client.RestClient.post',144 self.FAKE_CREATE_GROUP_FROM_GROUP_SNAPSHOT,145 status=202)146 def test_create_group_from_group(self):147 self.check_service_client_function(148 self.client.create_group_from_source,149 'tempest.lib.common.rest_client.RestClient.post',150 self.FAKE_CREATE_GROUP_FROM_GROUP,151 status=202)152 def test_update_group(self):153 self.check_service_client_function(154 self.client.update_group,155 'tempest.lib.common.rest_client.RestClient.put',156 {},157 group_id='0e701ab8-1bec-4b9f-b026-a7ba4af13578',158 status=202,159 **self.FAKE_UPDATE_GROUP['group'])160 def test_reset_group_status(self):161 self.check_service_client_function(162 self.client.reset_group_status,163 'tempest.lib.common.rest_client.RestClient.post',164 {},165 status=202,166 group_id='0e701ab8-1bec-4b9f-b026-a7ba4af13578',...

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