'Setup a test case environment.
Creates fake volume and snapshot objects and sets up the required
API responses.'

def setUp(self):

    super(TestCreateSnapShot, self).setUp()
    ctx = context.RequestContext('fake', 'fake', auth_token=True)
    self.fake_volume = fake_volume.fake_volume_obj(ctx, **{'provider_id': fake.PROVIDER_ID})
    self.snapshot = fake_snapshot.fake_snapshot_obj(ctx, **{'volume': self.fake_volume})
    self.mock_object(db.sqlalchemy.api, 'volume_get', self.return_fake_volume)
    snap_vol_id = self.snapshot.volume_id
    self.volume_name_2x_enc = urllib.parse.quote(urllib.parse.quote(self.driver._id_to_base64(snap_vol_id)))
    self.snapshot_name_2x_enc = urllib.parse.quote(urllib.parse.quote(self.driver._id_to_base64(self.snapshot.id)))
    self.snapshot_reply = json.dumps({'volumeIdList': ['cloned'], 'snapshotGroupId': 'cloned_snapshot'})
    self.HTTPS_MOCK_RESPONSES = {self.RESPONSE_MODE.Valid: {('types/Volume/instances/getByName::' + self.volume_name_2x_enc): '"{}"'.format(self.snapshot.volume_id), 'instances/System/action/snapshotVolumes': self.snapshot_reply, ('types/Volume/instances/getByName::' + self.snapshot_name_2x_enc): self.snapshot.id}, self.RESPONSE_MODE.BadStatus: {('types/Volume/instances/getByName::' + self.volume_name_2x_enc): self.BAD_STATUS_RESPONSE, ('types/Volume/instances/getByName::' + self.snapshot_name_2x_enc): self.BAD_STATUS_RESPONSE, 'instances/System/action/snapshotVolumes': self.BAD_STATUS_RESPONSE}, self.RESPONSE_MODE.Invalid: {('types/Volume/instances/getByName::' + self.volume_name_2x_enc): None, 'instances/System/action/snapshotVolumes': mocks.MockHTTPSResponse({'errorCode': 400, 'message': 'Invalid    Volume    Snapshot    Test'}, 400)}}
