예제 #1
0
    def req_wrapper(*args, **kwargs):
        actual_resp = fxn(*args, **kwargs)

        mocked_req = mock.MagicMock(google_http.HttpRequest)
        mocked_req.execute.return_value = actual_resp

        return mocked_req
예제 #2
0
    def setUp(self):
        self.fs = GCSFilesystem()
        self.gcs_path = 'gs://walrus/data'

        self.list_req_mock = mock.MagicMock()

        objects_ret = mock.MagicMock()
        objects_ret.list.return_value = self.list_req_mock
        objects_ret.get_media.return_value = google_http.HttpRequest(
            None, None, self.gcs_path)

        api_client = mock.MagicMock()
        api_client.objects.return_value = objects_ret

        self.fs._api_client = api_client
        self.next_chunk_patch = patch.object(
            google_http.MediaIoBaseDownload, 'next_chunk')