Example #1
0
def test_request_user_project():
    with gcs_maker():
        gcs = GCSFileSystem(TEST_PROJECT, token=GOOGLE_TOKEN, requester_pays=True)
        # test directly against `_call` to inspect the result
        r = gcs._call(
            "GET",
            "b/{}/o/",
            TEST_REQUESTER_PAYS_BUCKET,
            delimiter="/",
            prefix="test",
            maxResults=100,
        )
        qs = urlparse(r.request.url).query
        result = parse_qs(qs)
        assert result["userProject"] == [TEST_PROJECT]
Example #2
0
def test_request_header():
    with gcs_maker():
        gcs = GCSFileSystem(TEST_PROJECT,
                            token=GOOGLE_TOKEN,
                            requester_pays=True)
        # test directly against `_call` to inspect the result
        r = gcs._call(
            "GET",
            "b/{}/o/",
            TEST_REQUESTER_PAYS_BUCKET,
            delimiter="/",
            prefix="test",
            maxResults=100,
        )
        assert r.request.headers[
            "User-Agent"] == "dask-gcsfs/" + versioneer.get_version()