How to use tableaudocumentapi - 10 common examples

To help you get started, we’ve selected a few tableaudocumentapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tableau / document-api-python / test / bvt.py View on Github external
def test_can_extract_connection(self):
        ds = Datasource.from_file(self.tds_file.name)
        self.assertIsInstance(ds.connections[0], Connection)
        self.assertIsInstance(ds.connections, list)
github tableau / document-api-python / test / bvt.py View on Github external
def test_can_open_tdsx(self):
        ds = Datasource.from_file(self.tdsx_file.name)
        self.assertTrue(ds.connections)
        self.assertTrue(ds.name)
github tableau / document-api-python / test / test_datasource.py View on Github external
def setUp(self):
        self.ds = Datasource.from_file(TEST_TDS_FILE)
        self.to_delete = set()
github tableau / document-api-python / test / bvt.py View on Github external
def test_exception_when_datasource_given_twbx(self):
        with self.assertRaises(TableauInvalidFileException):
            ds = Datasource.from_file(TABLEAU_10_TWBX)
github tableau / document-api-python / test / bvt.py View on Github external
def test_can_save_tds(self):
        original_tds = Datasource.from_file(self.tds_file.name)
        original_tds.connections[0].dbname = 'newdb'
        original_tds.save()

        new_tds = Datasource.from_file(self.tds_file.name)
        self.assertEqual(new_tds.connections[0].dbname, 'newdb')
github tableau / document-api-python / test / bvt.py View on Github external
def test_can_extract_datasource_from_file(self):
        ds = Datasource.from_file(self.tds_file.name)
        self.assertEqual(ds.name, 'sqlserver.17u3bqc16tjtxn14e2hxh19tyvpo')
        self.assertEqual(ds.version, '9.3')
github tableau / document-api-python / test / bvt.py View on Github external
def test_can_open_tdsx_and_save_as_changes(self):
        new_tdsx_filename = 'newtdsx.tdsx'
        original_wb = Datasource.from_file(self.tdsx_file.name)
        original_wb.connections[0].server = 'newdb'
        original_wb.save_as(new_tdsx_filename)

        new_wb = Datasource.from_file(new_tdsx_filename)
        self.assertEqual(new_wb.connections[
                         0].server, 'newdb')
        os.unlink(new_tdsx_filename)
github tableau / document-api-python / test / bvt.py View on Github external
def test_can_open_tdsx_and_save_changes(self):
        original_tdsx = Datasource.from_file(self.tdsx_file.name)
        original_tdsx.connections[0].server = 'newdb'
        original_tdsx.save()

        new_tdsx = Datasource.from_file(self.tdsx_file.name)
        self.assertEqual(new_tdsx.connections[
                         0].server, 'newdb')
github tableau / document-api-python / test / test_datasource.py View on Github external
def test_datasource_can_remove_caption(self):
        filename = self.get_temp_file('test_datasource_can_remove_caption')
        del self.ds.caption
        self.ds.save_as(filename)

        actual = Datasource.from_file(filename)
        self.assertIsNotNone(actual)
        self.assertEqual(actual.caption, '')
github tableau / document-api-python / test / bvt.py View on Github external
def test_can_extract_datasourceV10(self):
        wb = Workbook(self.workbook_file.name)
        self.assertEqual(len(wb.datasources), 1)
        self.assertEqual(len(wb.datasources[0].connections), 2)
        self.assertIsInstance(wb.datasources[0].connections, list)
        self.assertIsInstance(wb.datasources[0], Datasource)
        self.assertEqual(wb.datasources[0].name,
                         'federated.1s4nxn20cywkdv13ql0yk0g1mpdx')