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
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
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
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
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
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
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