Best Python code snippet using uiautomator
test_hpe3par_offline_clone.py
Source:test_hpe3par_offline_clone.py
1# (C) Copyright 2018 Hewlett Packard Enterprise Development LP2#3# This program is free software; you can redistribute it and/or modify4# it under the terms of version 3 of the GNU General Public License as5# published by the Free Software Foundation. Alternatively, at your6# choice, you may also redistribute it and/or modify it under the terms7# of the Apache License, version 2.0, available at8#9# http://www.apache.org/licenses/LICENSE-2.010#11# This program is distributed in the hope that it will be useful, but12# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY13# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License14# for more details.15#16# You should have received a copy of the GNU General Public License along17# with this program. If not, see <https://www.gnu.org/licenses/>18import mock19import unittest20from Modules import hpe3par_offline_clone21from ansible.module_utils.basic import AnsibleModule22class TestHpe3parOfflineClone(unittest.TestCase):23 fields = {24 "state": {25 "required": True,26 "choices": ['present', 'absent', 'resync', 'stop'],27 "type": 'str'28 },29 "storage_system_ip": {30 "required": True,31 "type": "str"32 },33 "storage_system_username": {34 "required": True,35 "type": "str",36 "no_log": True37 },38 "storage_system_password": {39 "required": True,40 "type": "str",41 "no_log": True42 },43 "clone_name": {44 "required": True,45 "type": "str"46 },47 "base_volume_name": {48 "required": False,49 "type": "str"50 },51 "dest_cpg": {52 "required": False,53 "type": "str",54 },55 "save_snapshot": {56 "required": False,57 "type": "bool",58 },59 "priority": {60 "required": False,61 "type": "str",62 "choices": ['HIGH', 'MEDIUM', 'LOW'],63 "default": "MEDIUM"64 },65 "skip_zero": {66 "required": False,67 "type": "bool",68 }69 }70 @mock.patch('Modules.hpe3par_offline_clone.client')71 @mock.patch('Modules.hpe3par_offline_clone.AnsibleModule')72 def test_module_args(self, mock_module, mock_client):73 """74 hpe3par offline clone - test module arguments75 """76 PARAMS_FOR_PRESENT = {77 'storage_system_ip': '192.168.0.1',78 'storage_system_username': 'USER',79 'storage_system_password': 'PASS',80 'clone_name': 'test_clone',81 'base_volume_name': 'base_volume',82 'dest_cpg': 'dest_cpg',83 'save_snapshot': False,84 'priority': 'MEDIUM',85 'skip_zero': False,86 'state': 'present'87 }88 mock_module.params = PARAMS_FOR_PRESENT89 mock_module.return_value = mock_module90 hpe3par_offline_clone.main()91 mock_module.assert_called_with(92 argument_spec=self.fields)93 @mock.patch('Modules.hpe3par_offline_clone.client')94 @mock.patch('Modules.hpe3par_offline_clone.AnsibleModule')95 @mock.patch('Modules.hpe3par_offline_clone.create_offline_clone')96 def test_main_exit_present(self, mock_create_offline_clone, mock_module, mock_client):97 """98 hpe3par offline clone - success check99 """100 PARAMS_FOR_PRESENT = {101 'storage_system_ip': '192.168.0.1',102 'storage_system_name': '3PAR',103 'storage_system_username': 'USER',104 'storage_system_password': 'PASS',105 'clone_name': 'test_clone',106 'base_volume_name': 'base_volume',107 'dest_cpg': 'dest_cpg',108 'save_snapshot': False,109 'priority': 'MEDIUM',110 'skip_zero': False,111 'state': 'present'112 }113 # This creates a instance of the AnsibleModule mock.114 mock_module.params = PARAMS_FOR_PRESENT115 mock_module.return_value = mock_module116 instance = mock_module.return_value117 mock_create_offline_clone.return_value = (118 True, True, "Created Offline clone successfully.", {})119 hpe3par_offline_clone.main()120 # AnsibleModule.exit_json should be called121 instance.exit_json.assert_called_with(122 changed=True, msg="Created Offline clone successfully.")123 # AnsibleModule.fail_json should not be called124 self.assertEqual(instance.fail_json.call_count, 0)125 @mock.patch('Modules.hpe3par_offline_clone.client')126 @mock.patch('Modules.hpe3par_offline_clone.AnsibleModule')127 @mock.patch('Modules.hpe3par_offline_clone.delete_clone')128 def test_main_exit_absent(self, mock_delete_clone, mock_module, mock_client):129 """130 hpe3par offline clone - success check131 """132 PARAMS_FOR_ABSENT = {133 'storage_system_ip': '192.168.0.1',134 'storage_system_name': '3PAR',135 'storage_system_username': 'USER',136 'storage_system_password': 'PASS',137 'clone_name': 'test_clone',138 'base_volume_name': 'base_volume',139 'dest_cpg': None,140 'save_snapshot': None,141 'priority': None,142 'skip_zero': None,143 'state': 'absent'144 }145 # This creates a instance of the AnsibleModule mock.146 mock_module.params = PARAMS_FOR_ABSENT147 mock_module.return_value = mock_module148 instance = mock_module.return_value149 mock_delete_clone.return_value = (150 True, True, "Deleted Offline clone successfully.", {})151 hpe3par_offline_clone.main()152 # AnsibleModule.exit_json should be called153 instance.exit_json.assert_called_with(154 changed=True, msg="Deleted Offline clone successfully.")155 # AnsibleModule.fail_json should not be called156 self.assertEqual(instance.fail_json.call_count, 0)157 @mock.patch('Modules.hpe3par_offline_clone.client')158 @mock.patch('Modules.hpe3par_offline_clone.AnsibleModule')159 @mock.patch('Modules.hpe3par_offline_clone.resync_clone')160 def test_main_exit_resync(self, mock_resync_clone, mock_module, mock_client):161 """162 hpe3par offline clone - success check163 """164 PARAMS_FOR_RESYNC = {165 'storage_system_ip': '192.168.0.1',166 'storage_system_name': '3PAR',167 'storage_system_username': 'USER',168 'storage_system_password': 'PASS',169 'clone_name': 'test_clone',170 'base_volume_name': None,171 'dest_cpg': None,172 'save_snapshot': None,173 'priority': None,174 'skip_zero': None,175 'state': 'resync'176 }177 # This creates a instance of the AnsibleModule mock.178 mock_module.params = PARAMS_FOR_RESYNC179 mock_module.return_value = mock_module180 instance = mock_module.return_value181 mock_resync_clone.return_value = (182 True, True, "Resynced Offline clone successfully.", {})183 hpe3par_offline_clone.main()184 # AnsibleModule.exit_json should be called185 instance.exit_json.assert_called_with(186 changed=True, msg="Resynced Offline clone successfully.")187 # AnsibleModule.fail_json should not be called188 self.assertEqual(instance.fail_json.call_count, 0)189 @mock.patch('Modules.hpe3par_offline_clone.client')190 @mock.patch('Modules.hpe3par_offline_clone.AnsibleModule')191 @mock.patch('Modules.hpe3par_offline_clone.stop_clone')192 def test_main_exit_stop(self, mock_stop_clone, mock_module, mock_client):193 """194 hpe3par offline clone - success check195 """196 PARAMS_FOR_RESYNC = {197 'storage_system_ip': '192.168.0.1',198 'storage_system_name': '3PAR',199 'storage_system_username': 'USER',200 'storage_system_password': 'PASS',201 'clone_name': 'test_clone',202 'base_volume_name': 'base_volume',203 'dest_cpg': None,204 'save_snapshot': None,205 'priority': None,206 'skip_zero': None,207 'state': 'stop'208 }209 # This creates a instance of the AnsibleModule mock.210 mock_module.params = PARAMS_FOR_RESYNC211 mock_module.return_value = mock_module212 instance = mock_module.return_value213 mock_stop_clone.return_value = (214 True, True, "Stopped Offline clone successfully.", {})215 hpe3par_offline_clone.main()216 # AnsibleModule.exit_json should be called217 instance.exit_json.assert_called_with(218 changed=True, msg="Stopped Offline clone successfully.")219 # AnsibleModule.fail_json should not be called220 self.assertEqual(instance.fail_json.call_count, 0)221 @mock.patch('Modules.hpe3par_offline_clone.client')222 def test_create_offline_clone(self, mock_client):223 mock_client.HPE3ParClient.login.return_value = True224 mock_client.HPE3ParClient.setSSHOptions.return_value = True225 mock_client.HPE3ParClient.copyVolume.return_value = True226 mock_client.HPE3ParClient.onlinePhysicalCopyExists.return_value = False227 mock_client.HPE3ParClient.offlinePhysicalCopyExists.return_value = False228 mock_client.HPE3ParClient.logout.return_value = None229 self.assertEqual(hpe3par_offline_clone.create_offline_clone(mock_client.HPE3ParClient,230 '192.168.0.1',231 'USER',232 'PASS',233 'test_clone',234 'base_volume',235 'dest_cpg',236 False,237 False,238 'MEDIUM'239 ), (True, True, "Created Offline Clone %s successfully." % 'test_clone', {}))240 mock_client.HPE3ParClient.onlinePhysicalCopyExists.return_value = True241 self.assertEqual(hpe3par_offline_clone.create_offline_clone(mock_client.HPE3ParClient,242 '192.168.0.1',243 'USER',244 'PASS',245 'test_clone',246 'base_volume',247 'dest_cpg',248 False,249 False,250 'MEDIUM'251 ), (True, False, "Clone already exists / creation in progress. Nothing to do.", {}))252 self.assertEqual(hpe3par_offline_clone.create_offline_clone(mock_client.HPE3ParClient,253 '192.168.0.1',254 None,255 'PASS',256 'test_clone',257 'base_volume',258 'dest_cpg',259 False,260 False,261 'MEDIUM'262 ), (False, False, "Offline clone create failed. Storage system username or password is \263null", {}))264 self.assertEqual(hpe3par_offline_clone.create_offline_clone(mock_client.HPE3ParClient,265 '192.168.0.1',266 'USER',267 'PASS',268 None,269 'base_volume',270 'dest_cpg',271 False,272 False,273 'MEDIUM'274 ), (False, False, "Offline clone create failed. Clone name is null", {}))275 self.assertEqual(hpe3par_offline_clone.create_offline_clone(mock_client.HPE3ParClient,276 '192.168.0.1',277 'USER',278 'PASS',279 'test_clone',280 None,281 'dest_cpg',282 False,283 False,284 'MEDIUM'285 ), (False, False, "Offline clone create failed. Base volume name is null", {}))286 @mock.patch('Modules.hpe3par_offline_clone.client')287 def test_resync_clone(self, mock_client):288 mock_client.HPE3ParClient.login.return_value = True289 self.assertEqual(hpe3par_offline_clone.resync_clone(mock_client.HPE3ParClient,290 'USER',291 'PASS',292 'test_clone'293 ), (True, True, "Resync-ed Offline Clone %s successfully." % 'test_clone', {}))294 self.assertEqual(hpe3par_offline_clone.resync_clone(mock_client.HPE3ParClient,295 None,296 'PASS',297 'test_clone'298 ), (False, False, "Offline clone resync failed. Storage system username or password is null", {}))299 self.assertEqual(hpe3par_offline_clone.resync_clone(mock_client.HPE3ParClient,300 'USER',301 'PASS',302 None303 ), (False, False, "Offline clone resync failed. Clone name is null", {}))304 @mock.patch('Modules.hpe3par_offline_clone.client')305 def test_stop_clone(self, mock_client):306 mock_client.HPE3ParClient.login.return_value = True307 mock_client.HPE3ParClient.setSSHOptions.return_value = True308 mock_client.HPE3ParClient.volumeExists.return_value = True309 mock_client.HPE3ParClient.offlinePhysicalCopyExists.return_value = True310 mock_client.HPE3ParClient.stopOfflinePhysicalCopy.return_value = None311 self.assertEqual(hpe3par_offline_clone.stop_clone(mock_client.HPE3ParClient,312 '192.168.0.1',313 'USER',314 'PASS',315 'test_clone',316 'base_volume'317 ), (True, True, "Stopped Offline Clone %s successfully." % 'test_clone', {}))318 mock_client.HPE3ParClient.volumeExists.return_value = False319 self.assertEqual(hpe3par_offline_clone.stop_clone(mock_client.HPE3ParClient,320 '192.168.0.1',321 'USER',322 'PASS',323 'test_clone',324 'base_volume'325 ), (True, False, "Offline Cloning not in progress", {}))326 self.assertEqual(hpe3par_offline_clone.stop_clone(mock_client.HPE3ParClient,327 '192.168.0.1',328 None,329 'PASS',330 'test_clone',331 'base_volume'332 ), (False, False, "Offline clone stop failed. Storage system username or password is null", {}))333 self.assertEqual(hpe3par_offline_clone.stop_clone(mock_client.HPE3ParClient,334 '192.168.0.1',335 'USER',336 'PASS',337 None,338 'base_volume'339 ), (False, False, "Offline clone stop failed. Clone name is null", {}))340 self.assertEqual(hpe3par_offline_clone.stop_clone(mock_client.HPE3ParClient,341 '192.168.0.1',342 'USER',343 'PASS',344 'test_clone',345 None346 ), (False, False, "Offline clone stop failed. Base volume name is null", {}))347 @mock.patch('Modules.hpe3par_offline_clone.client')348 def test_delete_clone(self, mock_client):349 mock_client.HPE3ParClient.login.return_value = True350 mock_client.HPE3ParClient.setSSHOptions.return_value = True351 mock_client.HPE3ParClient.volumeExists.return_value = True352 mock_client.HPE3ParClient.offlinePhysicalCopyExists.return_value = False353 mock_client.HPE3ParClient.onlinePhysicalCopyExists.return_value = False354 mock_client.HPE3ParClient.deleteVolume.return_value = None355 self.assertEqual(hpe3par_offline_clone.delete_clone(mock_client.HPE3ParClient,356 '192.168.0.1',357 'USER',358 'PASS',359 'test_clone',360 'base_volume'361 ), (True, True, "Deleted Offline Clone %s successfully." % 'test_clone', {}))362 mock_client.HPE3ParClient.offlinePhysicalCopyExists.return_value = True363 self.assertEqual(hpe3par_offline_clone.delete_clone(mock_client.HPE3ParClient,364 '192.168.0.1',365 'USER',366 'PASS',367 'test_clone',368 'base_volume'369 ), (False, False, "Clone/Volume is busy. Cannot be deleted", {}))370 self.assertEqual(hpe3par_offline_clone.delete_clone(mock_client.HPE3ParClient,371 '192.168.0.1',372 None,373 'PASS',374 'test_clone',375 'base_volume'376 ), (False, False, "Offline clone delete failed. Storage system username or password is null", {}))377 self.assertEqual(hpe3par_offline_clone.delete_clone(mock_client.HPE3ParClient,378 '192.168.0.1',379 'USER',380 'PASS',381 None,382 'base_volume'383 ), (False, False, "Offline clone delete failed. Clone name is null", {}))384 self.assertEqual(hpe3par_offline_clone.delete_clone(mock_client.HPE3ParClient,385 '192.168.0.1',386 'USER',387 'PASS',388 'test_clone',389 None390 ), (False, False, "Offline clone delete failed. Base volume name is null", {}))391if __name__ == '__main__':...
test_hpe3par_online_clone.py
Source:test_hpe3par_online_clone.py
1# (C) Copyright 2018 Hewlett Packard Enterprise Development LP2#3# This program is free software; you can redistribute it and/or modify4# it under the terms of version 3 of the GNU General Public License as5# published by the Free Software Foundation. Alternatively, at your6# choice, you may also redistribute it and/or modify it under the terms7# of the Apache License, version 2.0, available at8#9# http://www.apache.org/licenses/LICENSE-2.010#11# This program is distributed in the hope that it will be useful, but12# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY13# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License14# for more details.15#16# You should have received a copy of the GNU General Public License along17# with this program. If not, see <https://www.gnu.org/licenses/>18import mock19import unittest20from Modules import hpe3par_online_clone21from ansible.module_utils.basic import AnsibleModule22class TestHpe3parOnlineClone(unittest.TestCase):23 fields = {24 "state": {25 "required": True,26 "choices": ['present', 'absent', 'resync'],27 "type": 'str'28 },29 "storage_system_ip": {30 "required": True,31 "type": "str"32 },33 "storage_system_username": {34 "required": True,35 "type": "str",36 "no_log": True37 },38 "storage_system_password": {39 "required": True,40 "type": "str",41 "no_log": True42 },43 "clone_name": {44 "required": True,45 "type": "str"46 },47 "base_volume_name": {48 "required": False,49 "type": "str"50 },51 "dest_cpg": {52 "required": False,53 "type": "str",54 },55 "tpvv": {56 "required": False,57 "type": "bool",58 },59 "tdvv": {60 "required": False,61 "type": "bool",62 },63 "snap_cpg": {64 "required": False,65 "type": "str",66 },67 "compression": {68 "required": False,69 "type": "bool",70 }71 }72 @mock.patch('Modules.hpe3par_online_clone.client')73 @mock.patch('Modules.hpe3par_online_clone.AnsibleModule')74 def test_module_args(self, mock_module, mock_client):75 """76 hpe3par online clone - test module arguments77 """78 PARAMS_FOR_PRESENT = {79 'storage_system_ip': '192.168.0.1',80 'storage_system_username': 'USER',81 'storage_system_password': 'PASS',82 'clone_name': 'test_clone',83 'base_volume_name': 'base_volume',84 'dest_cpg': 'dest_cpg',85 'tpvv': False,86 'tdvv': False,87 'snap_cpg': 'snap_cpg',88 'compression': False,89 'state': 'present'90 }91 mock_module.params = PARAMS_FOR_PRESENT92 mock_module.return_value = mock_module93 hpe3par_online_clone.main()94 mock_module.assert_called_with(95 argument_spec=self.fields)96 @mock.patch('Modules.hpe3par_online_clone.client')97 @mock.patch('Modules.hpe3par_online_clone.AnsibleModule')98 @mock.patch('Modules.hpe3par_online_clone.create_online_clone')99 def test_main_exit_present(self, mock_create_online_clone, mock_module, mock_client):100 """101 hpe3par online clone - success check102 """103 PARAMS_FOR_PRESENT = {104 'storage_system_ip': '192.168.0.1',105 'storage_system_name': '3PAR',106 'storage_system_username': 'USER',107 'storage_system_password': 'PASS',108 'clone_name': 'test_clone',109 'base_volume_name': 'base_volume',110 'dest_cpg': 'dest_cpg',111 'tpvv': False,112 'tdvv': False,113 'snap_cpg': 'snap_cpg',114 'compression': False,115 'state': 'present'116 }117 # This creates a instance of the AnsibleModule mock.118 mock_module.params = PARAMS_FOR_PRESENT119 mock_module.return_value = mock_module120 instance = mock_module.return_value121 mock_create_online_clone.return_value = (122 True, True, "Created Online clone successfully.", {})123 hpe3par_online_clone.main()124 # AnsibleModule.exit_json should be called125 instance.exit_json.assert_called_with(126 changed=True, msg="Created Online clone successfully.")127 # AnsibleModule.fail_json should not be called128 self.assertEqual(instance.fail_json.call_count, 0)129 @mock.patch('Modules.hpe3par_online_clone.client')130 @mock.patch('Modules.hpe3par_online_clone.AnsibleModule')131 @mock.patch('Modules.hpe3par_online_clone.delete_clone')132 def test_main_exit_absent(self, mock_delete_clone, mock_module, mock_client):133 """134 hpe3par online clone - success check135 """136 PARAMS_FOR_ABSENT = {137 'storage_system_ip': '192.168.0.1',138 'storage_system_name': '3PAR',139 'storage_system_username': 'USER',140 'storage_system_password': 'PASS',141 'clone_name': 'test_clone',142 'base_volume_name': 'base_volume',143 'dest_cpg': None,144 'tpvv': False,145 'tdvv': False,146 'snap_cpg': 'snap_cpg',147 'compression': False,148 'state': 'absent'149 }150 # This creates a instance of the AnsibleModule mock.151 mock_module.params = PARAMS_FOR_ABSENT152 mock_module.return_value = mock_module153 instance = mock_module.return_value154 mock_delete_clone.return_value = (155 True, True, "Deleted Online clone successfully.", {})156 hpe3par_online_clone.main()157 # AnsibleModule.exit_json should be called158 instance.exit_json.assert_called_with(159 changed=True, msg="Deleted Online clone successfully.")160 # AnsibleModule.fail_json should not be called161 self.assertEqual(instance.fail_json.call_count, 0)162 @mock.patch('Modules.hpe3par_online_clone.client')163 @mock.patch('Modules.hpe3par_online_clone.AnsibleModule')164 @mock.patch('Modules.hpe3par_online_clone.resync_clone')165 def test_main_exit_resync(self, mock_resync_clone, mock_module, mock_client):166 """167 hpe3par online clone - success check168 """169 PARAMS_FOR_RESYNC = {170 'storage_system_ip': '192.168.0.1',171 'storage_system_name': '3PAR',172 'storage_system_username': 'USER',173 'storage_system_password': 'PASS',174 'clone_name': 'test_clone',175 'base_volume_name': None,176 'dest_cpg': None,177 'tpvv': False,178 'tdvv': False,179 'snap_cpg': 'snap_cpg',180 'compression': False,181 'state': 'resync'182 }183 # This creates a instance of the AnsibleModule mock.184 mock_module.params = PARAMS_FOR_RESYNC185 mock_module.return_value = mock_module186 instance = mock_module.return_value187 mock_resync_clone.return_value = (188 True, True, "Resynced Online clone successfully.", {})189 hpe3par_online_clone.main()190 # AnsibleModule.exit_json should be called191 instance.exit_json.assert_called_with(192 changed=True, msg="Resynced Online clone successfully.")193 # AnsibleModule.fail_json should not be called194 self.assertEqual(instance.fail_json.call_count, 0)195 @mock.patch('Modules.hpe3par_online_clone.client')196 def test_create_online_clone(self, mock_client):197 mock_client.HPE3ParClient.login.return_value = None198 mock_client.HPE3ParClient.volumeExists.return_value = False199 mock_client.HPE3ParClient.copyVolume.return_value = None200 mock_client.HPE3ParClient.logout.return_value = None201 self.assertEqual(hpe3par_online_clone.create_online_clone(mock_client.HPE3ParClient,202 'USER',203 'PASS',204 'base_volume',205 'test_clone',206 'dest_cpg',207 False,208 False,209 'snap_cpg',210 False211 ), (True, True, "Created Online Clone %s successfully." % 'test_clone', {}))212 mock_client.HPE3ParClient.volumeExists.return_value = True213 self.assertEqual(hpe3par_online_clone.create_online_clone(mock_client.HPE3ParClient,214 'USER',215 'PASS',216 'base_volume',217 'test_clone',218 'dest_cpg',219 False,220 False,221 'snap_cpg',222 False223 ), (True, False, "Clone already exists / creation in progress. Nothing to do.", {}))224 self.assertEqual(hpe3par_online_clone.create_online_clone(mock_client.HPE3ParClient,225 'USER',226 None,227 'base_volume',228 'test_clone',229 'dest_cpg',230 False,231 False,232 'snap_cpg',233 False234 ), (False, False, "Online clone create failed. Storage system username or password \235is null", {}))236 self.assertEqual(hpe3par_online_clone.create_online_clone(mock_client.HPE3ParClient,237 'USER',238 'PASS',239 'base_volume',240 None,241 'dest_cpg',242 False,243 False,244 'snap_cpg',245 False246 ), (False, False, "Online clone create failed. Clone name is null", {}))247 self.assertEqual(hpe3par_online_clone.create_online_clone(mock_client.HPE3ParClient,248 'USER',249 'PASS',250 None,251 'test_clone',252 'dest_cpg',253 False,254 False,255 'snap_cpg',256 False257 ), (False, False, "Online clone create failed. Base volume name is null", {}))258 @mock.patch('Modules.hpe3par_online_clone.client')259 def test_delete_clone(self, mock_client):260 mock_client.HPE3ParClient.login.return_value = True261 mock_client.HPE3ParClient.setSSHOptions.return_value = True262 mock_client.HPE3ParClient.volumeExists.return_value = True263 mock_client.HPE3ParClient.offlinePhysicalCopyExists.return_value = False264 mock_client.HPE3ParClient.onlinePhysicalCopyExists.return_value = False265 mock_client.HPE3ParClient.deleteVolume.return_value = None266 self.assertEqual(hpe3par_online_clone.delete_clone(mock_client.HPE3ParClient,267 '192.168.0.1',268 'USER',269 'PASS',270 'test_clone',271 'base_volume'272 ), (True, True, "Deleted Online Clone %s successfully." % 'test_clone', {}))273 mock_client.HPE3ParClient.offlinePhysicalCopyExists.return_value = True274 self.assertEqual(hpe3par_online_clone.delete_clone(mock_client.HPE3ParClient,275 '192.168.0.1',276 'USER',277 'PASS',278 'test_clone',279 'base_volume'280 ), (False, False, "Clone/Volume is busy. Cannot be deleted", {}))281 self.assertEqual(hpe3par_online_clone.delete_clone(mock_client.HPE3ParClient,282 '192.168.0.1',283 None,284 'PASS',285 'test_clone',286 'base_volume'287 ), (False, False, "Online clone delete failed. Storage system username or password is null", {}))288 self.assertEqual(hpe3par_online_clone.delete_clone(mock_client.HPE3ParClient,289 '192.168.0.1',290 'USER',291 'PASS',292 None,293 'base_volume'294 ), (False, False, "Online clone delete failed. Clone name is null", {}))295 self.assertEqual(hpe3par_online_clone.delete_clone(mock_client.HPE3ParClient,296 '192.168.0.1',297 'USER',298 'PASS',299 'test_clone',300 None301 ), (False, False, "Online clone delete failed. Base volume name is null", {}))302 @mock.patch('Modules.hpe3par_online_clone.client')303 def test_resync_clone(self, mock_client):304 mock_client.HPE3ParClient.login.return_value = True305 self.assertEqual(hpe3par_online_clone.resync_clone(mock_client.HPE3ParClient,306 'USER',307 'PASS',308 'test_clone'309 ), (True, True, "Resync-ed Online Clone %s successfully." % 'test_clone', {}))310 self.assertEqual(hpe3par_online_clone.resync_clone(mock_client.HPE3ParClient,311 None,312 'PASS',313 'test_clone'314 ), (False, False, "Online clone resync failed. Storage system username or password is null", {}))315 self.assertEqual(hpe3par_online_clone.resync_clone(mock_client.HPE3ParClient,316 'USER',317 'PASS',318 None319 ), (False, False, "Online clone resync failed. Clone name is null", {}))320if __name__ == '__main__':...
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!!