Beispiel #1
0
def test_search_looks_returns_looks(sdk: mtds.Looker31SDK):
    """search_looks() should return a list of looks."""
    search_results = sdk.search_looks()
    assert isinstance(search_results, list)
    assert len(search_results) > 0
    look = search_results[0]
    assert isinstance(look, ml.Look)
    assert look.title != ""
    assert look.created_at is not None
Beispiel #2
0
def test_search_looks_title_fields_filter(sdk: mtds.Looker31SDK):
    """search_looks() should be able to filter on title."""
    search_results = sdk.search_looks(title="An SDK%", fields="id, title")
    assert isinstance(search_results, list)
    assert len(search_results) > 0
    look = search_results[0]
    assert isinstance(look.id, int)
    assert look.id > 0
    assert "SDK" in look.title
    assert look.description is None
Beispiel #3
0
def test_search_looks_fields_filter(sdk: mtds.Looker31SDK):
    """search_looks() should only return the requested fields passed in the fields
    argument of the request.
    """
    search_results = sdk.search_looks(fields="id, title, description")
    assert isinstance(search_results, list)
    assert len(search_results) > 0
    look = search_results[0]
    assert isinstance(look, ml.Look)
    assert look.title is not None
    assert look.created_at is None
Beispiel #4
0
def test_search_look_and_run(sdk: mtds.Looker31SDK):
    """run_look() should return CSV and JSON
    CSV will use column descriptions
    JSON will use column names
    JSON_LABEL will use column descriptions
    """
    search_results = sdk.search_looks(title="An SDK Look", fields="id, title")
    assert isinstance(search_results, list)
    assert len(search_results) > 0
    look = search_results[0]
    assert isinstance(look.id, int)
    assert look.id > 0
    assert "SDK" in look.title
    assert look.description is None
    actual = sdk.run_look(look_id=look.id, result_format="csv")
    assert "Dashboard Count" in actual
    assert "Dashboard ID" in actual
    actual = sdk.run_look(look_id=look.id, result_format="json")
    assert "dashboard.count" in actual
    assert "dashboard.id" in actual
    actual = sdk.run_look(look_id=look.id, result_format="json_label")
    assert "Dashboard Count" in actual
    assert "Dashboard ID" in actual