Ejemplo n.º 1
0
def test_dataset(requests_mock):
    with open("tests/data/catalog.json", "r+") as f:
        txt = json.dumps(json.load(f))
    requests_mock.get("https://example.com/api/v3/catalog", text=txt)
    with open("tests/data/testsource.json", "r+") as f:
        txt = json.dumps(json.load(f))
    requests_mock.get("https://example.com/api/v3/catalog/71373b4d-b284-4007-bdc1-2c4d245563ec", text=txt)
    with open("tests/data/profiles.json", "r+") as f:
        txt = json.dumps(json.load(f))
    requests_mock.get("https://example.com/api/v3/catalog/by-path/testsource/profiles", text=txt)

    token = "12345"
    c = catalog(token, "https://example.com", lambda x: x)
    sql = c.testsource.profiles.sql
    assert sql("hello") == "hello"
Ejemplo n.º 2
0
def test_dataset(requests_mock):
    with open('tests/data/catalog.json', 'r+') as f:
        txt = json.dumps(json.load(f))
    requests_mock.get('https://example.com/api/v3/catalog', text=txt)
    with open('tests/data/adls.json', 'r+') as f:
        txt = json.dumps(json.load(f))
    requests_mock.get('https://example.com/api/v3/catalog/1a2b82e3-08fc-43f7-a426-76bee4abaaef', text=txt)
    with open('tests/data/profiles.json', 'r+') as f:
        txt = json.dumps(json.load(f))
    requests_mock.get('https://example.com/api/v3/catalog/by-path/adls/profiles', text=txt)

    token = '12345'
    c = catalog(token, 'https://example.com', lambda x: x)
    sql = c.adls.profiles.sql
    assert sql('hello') == 'hello'
Ejemplo n.º 3
0
def test_catalog(requests_mock):
    with open("tests/data/catalog.json", "r+") as f:
        txt = json.dumps(json.load(f))
    requests_mock.get("https://example.com/api/v3/catalog", text=txt)
    with open("tests/data/testsource.json", "r+") as f:
        txt = json.dumps(json.load(f))
    requests_mock.get("https://example.com/api/v3/catalog/71373b4d-b284-4007-bdc1-2c4d245563ec", text=txt)
    with open("tests/data/nyctaxi.json", "r+") as f:
        txt = json.dumps(json.load(f))
    requests_mock.get("https://example.com/api/v3/catalog/by-path/testsource/%22nyctaxi%22", text=txt)

    token = "12345"
    c = catalog(token, "https://example.com", print)
    assert "testsource" in dir(c)
    assert "nyctaxi" in dir(c.testsource)
    assert "foo_csv" in dir(c.testsource.nyctaxi)
Ejemplo n.º 4
0
def test_catalog(requests_mock):
    with open('tests/data/catalog.json', 'r+') as f:
        txt = json.dumps(json.load(f))
    requests_mock.get('https://example.com/api/v3/catalog', text=txt)
    with open('tests/data/adls.json', 'r+') as f:
        txt = json.dumps(json.load(f))
    requests_mock.get('https://example.com/api/v3/catalog/1a2b82e3-08fc-43f7-a426-76bee4abaaef', text=txt)
    with open('tests/data/nyctaxi.json', 'r+') as f:
        txt = json.dumps(json.load(f))
    requests_mock.get('https://example.com/api/v3/catalog/by-path/adls/nyctaxi', text=txt)

    token = '12345'
    c = catalog(token, 'https://example.com', print)
    assert 'adls' in dir(c)
    assert 'nyctaxi' in dir(c.adls)
    assert 'yellow_tripdata_2009_01_csv' in dir(c.adls.nyctaxi)