Exemplo n.º 1
0
def test_getTableauData(httpserver, mocker: MockerFixture):
    ts = TS()
    ts.session = requests.Session()
    httpserver.serve_content(tableauDataResponse)
    ts.host = httpserver.url + "/"
    ts.tableauData = {"vizql_root": "", "sessionid": "", "sheetId": ""}
    result = api.getTableauData(ts)
    assert result == tableauDataResponse
Exemplo n.º 2
0
def test_setParameterValue(httpserver, mocker: MockerFixture):
    mocker.patch("tableauscraper.api.getTableauViz",
                 return_value=tableauVizHtmlResponse)
    mocker.patch("tableauscraper.api.getTableauData",
                 return_value=tableauDataResponse)
    ts = TS()
    ts.loads(fakeUri)
    httpserver.serve_content(json.dumps(vqlCmdResponse))
    ts.host = httpserver.url + "/"
    result = api.setParameterValue(scraper=ts, parameterName="", value="test")
    assert result == vqlCmdResponse
Exemplo n.º 3
0
def test_gotosheet(httpserver, mocker: MockerFixture):
    mocker.patch("tableauscraper.api.getTableauViz",
                 return_value=tableauVizHtmlResponse)
    mocker.patch("tableauscraper.api.getTableauData",
                 return_value=tableauDataResponse)
    ts = TS()
    ts.loads(fakeUri)
    httpserver.serve_content(json.dumps(vqlCmdResponse))
    ts.host = httpserver.url + "/"
    result = api.goToSheet(scraper=ts, windowId="")
    assert result == vqlCmdResponse
Exemplo n.º 4
0
def test_select(httpserver, mocker: MockerFixture):
    mocker.patch("tableauscraper.api.getTableauViz",
                 return_value=tableauVizHtmlResponse)
    mocker.patch("tableauscraper.api.getTableauData",
                 return_value=tableauDataResponse)
    ts = TS()
    ts.loads(fakeUri)
    httpserver.serve_content(json.dumps(vqlCmdResponse))
    ts.host = httpserver.url + "/"
    result = api.select(scraper=ts, worksheetName="", selection=[1])
    assert result == vqlCmdResponse
Exemplo n.º 5
0
def test_setActiveStoryPoint(httpserver, mocker: MockerFixture):
    mocker.patch("tableauscraper.api.getTableauViz",
                 return_value=tableauVizHtmlResponse)
    mocker.patch("tableauscraper.api.getTableauData",
                 return_value=tableauDataResponse)
    ts = TS()
    ts.loads(fakeUri)
    httpserver.serve_content(json.dumps(vqlCmdResponse))
    ts.host = httpserver.url + "/"
    result = api.setActiveStoryPoint(scraper=ts, storyBoard="", storyPointId=1)
    assert result == vqlCmdResponse
Exemplo n.º 6
0
def test_getCsvData(httpserver, mocker: MockerFixture):
    mocker.patch("tableauscraper.api.getTableauViz",
                 return_value=tableauVizHtmlResponse)
    mocker.patch("tableauscraper.api.getTableauData",
                 return_value=tableauDataResponse)
    ts = TS()
    ts.loads(fakeUri)
    httpserver.serve_content(tableauDownloadableCsvData)
    ts.host = httpserver.url + "/"
    result = api.getCsvData(scraper=ts, viewId="")
    assert result == tableauDownloadableCsvData
Exemplo n.º 7
0
def test_getDownloadableUnderlyingData(httpserver, mocker: MockerFixture):
    mocker.patch("tableauscraper.api.getTableauViz",
                 return_value=tableauVizHtmlResponse)
    mocker.patch("tableauscraper.api.getTableauData",
                 return_value=tableauDataResponse)
    ts = TS()
    ts.loads(fakeUri)
    httpserver.serve_content(json.dumps(tableauDownloadableUnderlyingData))
    ts.host = httpserver.url + "/"
    ts.tableauData = {"vizql_root": "", "sessionid": "", "sheetId": ""}
    result = api.getDownloadableUnderlyingData(scraper=ts,
                                               worksheetName="",
                                               dashboardName="",
                                               numRows=200)
    assert result == tableauDownloadableUnderlyingData