def setUp(self): super(AttachmentsAPITestCase, self).setUp() self.controller = v3_attachments.AttachmentsController() self.volume_api = volume_api.API() self.ctxt = context.RequestContext(fake.USER_ID, fake.PROJECT_ID, auth_token=True, is_admin=True) self.volume1 = self._create_volume(display_name='fake_volume_1', project_id=fake.PROJECT_ID) self.volume2 = self._create_volume(display_name='fake_volume_2', project_id=fake.PROJECT2_ID) self.attachment1 = self._create_attachment(volume_uuid=self.volume1.id, instance_uuid=fake.UUID1, host='host-a') self.attachment2 = self._create_attachment(volume_uuid=self.volume1.id, instance_uuid=fake.UUID1, host='host-b') self.attachment3 = self._create_attachment(volume_uuid=self.volume1.id, instance_uuid=fake.UUID2, host='host-c') self.attachment4 = self._create_attachment(volume_uuid=self.volume2.id, instance_uuid=fake.UUID2, host='host-d') self.addCleanup(self._cleanup)
def setUp(self, enforce_scope=False, enforce_new_defaults=False, *args, **kwargs): super().setUp(enforce_scope, enforce_new_defaults, *args, **kwargs) self.controller = attachments.AttachmentsController() self.manager = volume_manager.VolumeManager() self.manager.driver = mock.MagicMock() self.manager.driver.initialize_connection = mock.MagicMock() self.manager.driver.initialize_connection.side_effect = ( self._initialize_connection) self.api_path = '/v3/%s/attachments' % (self.project_id) self.api_version = mv.NEW_ATTACH
def setUp(self): super(AttachmentsAPITestCase, self).setUp() self.controller = v3_attachments.AttachmentsController() self.volume_api = volume_api.API() self.ctxt = context.RequestContext(fake.USER_ID, fake.PROJECT_ID, auth_token=True, is_admin=True) self.attachment1 = self._create_attachement(volume_uuid=fake.VOLUME_ID, instance_uuid=fake.UUID1) self.attachment2 = self._create_attachement( volume_uuid=fake.VOLUME2_ID, instance_uuid=fake.UUID1) self.attachment3 = self._create_attachement( volume_uuid=fake.VOLUME3_ID, instance_uuid=fake.UUID2) self.addCleanup(self._cleanup)