Best Python code snippet using tempest_python
test_cinder_workflow.py
Source:test_cinder_workflow.py
...59 mock_cinder_api.unreserve_volume.assert_not_called()60 @mock.patch('zun.volume.cinder_workflow.get_volume_connector')61 @mock.patch('zun.volume.cinder_workflow.get_volume_connector_properties')62 @mock.patch('zun.volume.cinder_api.CinderAPI')63 def test_attach_volume_fail_reserve_volume(64 self, mock_cinder_api_cls, mock_get_connector_prprts,65 mock_get_volume_connector):66 mock_cinder_api, mock_connector = self._test_attach_volume(67 mock_cinder_api_cls, mock_get_connector_prprts,68 mock_get_volume_connector, fail_reserve=True)69 mock_cinder_api.reserve_volume.assert_called_once_with(70 self.fake_volume_id)71 mock_cinder_api.initialize_connection.assert_not_called()72 mock_connector.connect_volume.assert_not_called()73 mock_cinder_api.attach.assert_not_called()74 mock_connector.disconnect_volume.assert_not_called()75 mock_cinder_api.terminate_connection.assert_not_called()76 mock_cinder_api.detach.assert_not_called()77 mock_cinder_api.unreserve_volume.assert_called_once_with(...
test_volumes_negative.py
Source:test_volumes_negative.py
...190 str(uuid.uuid4()))191 @test.attr(type=['negative', 'gate'])192 def test_reserve_volume_with_negative_volume_status(self):193 # Mark volume as reserved.194 _, body = self.client.reserve_volume(self.volume['id'])195 # Mark volume which is marked as reserved before196 self.assertRaises(exceptions.BadRequest,197 self.client.reserve_volume,198 self.volume['id'])199 # Unmark volume as reserved.200 _, body = self.client.unreserve_volume(self.volume['id'])201 @test.attr(type=['negative', 'gate'])202 def test_list_volumes_with_nonexistent_name(self):203 v_name = data_utils.rand_name('Volume-')204 params = {self.name_field: v_name}205 _, fetched_volume = self.client.list_volumes(params)206 self.assertEqual(0, len(fetched_volume))207 @test.attr(type=['negative', 'gate'])208 def test_list_volumes_detail_with_nonexistent_name(self):209 v_name = data_utils.rand_name('Volume-')210 params = {self.name_field: v_name}211 _, fetched_volume = self.client.list_volumes_with_detail(params)212 self.assertEqual(0, len(fetched_volume))213 @test.attr(type=['negative', 'gate'])214 def test_list_volumes_with_invalid_status(self):...
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!!