Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']

runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-e2-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']

runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']

runs-on: ${{ matrix.os }}

Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ authors = [{name="Tableau", email="github@tableau.com"}]
license = "MIT"
license-files = ["LICENSE"]
readme = "res/README.md"
requires-python = ">=3.9" # https://devguide.python.org/versions/
requires-python = ">=3.10" # https://devguide.python.org/versions/
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13"
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14"
]
dependencies = [
"appdirs",
Expand Down
26 changes: 13 additions & 13 deletions tabcmd/commands/datasources_and_workbooks/publish_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,21 @@ def run_command(args):

publish_mode = PublishCommand.get_publish_mode(args, logger)

connection = TSC.models.ConnectionItem()
# Build both forms: workbook "connections" (ConnectionItem) and datasource "connection_credentials"
workbook_connections = None
datasource_credentials = None
if args.db_username:
connection.connection_credentials = TSC.models.ConnectionCredentials(
args.db_username, args.db_password, embed=args.save_db_password
)
creds = TSC.models.ConnectionCredentials(args.db_username, args.db_password, embed=args.save_db_password)
workbook_connections = TSC.ConnectionItem()
workbook_connections.connection_credentials = creds
datasource_credentials = creds
elif args.oauth_username:
connection.connection_credentials = TSC.models.ConnectionCredentials(
args.oauth_username, None, embed=False, oauth=args.save_oauth
)
creds = TSC.models.ConnectionCredentials(args.oauth_username, None, embed=False, oauth=args.save_oauth)
workbook_connections = TSC.ConnectionItem()
workbook_connections.connection_credentials = creds
datasource_credentials = creds
else:
logger.debug("No db-username or oauth-username found in command")
creds = None
credentials = TSC.ConnectionItem() if creds else None
if credentials:
credentials.connection_credentials = creds

files = PublishCommand.get_files_to_publish(args, logger)

Expand All @@ -94,7 +94,7 @@ def run_command(args):
project_id=project_id,
str_filename=str_filename,
publish_mode=publish_mode,
credentials=credentials,
credentials=workbook_connections,
)
except Exception as e:
Errors.exit_with_error(logger, exception=e)
Expand All @@ -109,7 +109,7 @@ def run_command(args):
project_id=project_id,
str_filename=str_filename,
publish_mode=publish_mode,
credentials=creds,
credentials=datasource_credentials,
)
except Exception as exc:
Errors.exit_with_error(logger, exception=exc)
Expand Down
10 changes: 9 additions & 1 deletion tests/assets/mock_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,15 @@ def set_up_mock_server(mock_session):
mock_server.any_item_type = getter
mock_server.flows = getter
mock_server.groups = getter
mock_server.projects = getter
# Ensure type name contains 'Projects' for filtering heuristics
class ProjectsEndpoint:
def __init__(self, ret):
self._ret = ret

def get(self, req_option):
return self._ret

mock_server.projects = ProjectsEndpoint(([create_fake_item()], fake_pagination))
mock_server.sites = getter
mock_server.users = getter
mock_server.views = getter
Expand Down
13 changes: 8 additions & 5 deletions tests/commands/test_publish_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
import tableauserverclient as TSC
from ..assets import mock_data
from unittest.mock import *
from unittest import mock
from tabcmd.commands.datasources_and_workbooks.publish_command import PublishCommand
from tabcmd.commands.datasources_and_workbooks import publish_command

from ..assets.mock_data import set_up_mock_args, set_up_mock_file, set_up_mock_path, set_up_mock_server

mock_args = set_up_mock_args()
mock_logger = mock.MagicMock()


# mock the module as it is imported *when used*
Expand Down Expand Up @@ -83,39 +86,39 @@ def test_get_files_to_publish_folder(self, mock_path, mock_glob, mock_session):
actual = PublishCommand.get_files_to_publish(mock_args, logging)
assert actual == expected

def test_default_publish_mode(self, mock_session, mock_server):
def test_default_publish_mode(self, mock_path, mock_glob, mock_session):
mock_args.replace = False
mock_args.append = False
mock_args.overwrite = False

publish_mode = publish_command.PublishCommand.get_publish_mode(mock_args, mock_logger)
self.assertEqual(publish_mode, TSC.Server.PublishMode.CreateNew)

def test_replace_publish_mode(self, mock_session, mock_server):
def test_replace_publish_mode(self, mock_path, mock_glob, mock_session):
mock_args.replace = True
mock_args.append = False
mock_args.overwrite = False

publish_mode = publish_command.PublishCommand.get_publish_mode(mock_args, mock_logger)
self.assertEqual(publish_mode, TSC.Server.PublishMode.Replace)

def test_append_publish_mode(self, mock_session, mock_server):
def test_append_publish_mode(self, mock_path, mock_glob, mock_session):
mock_args.replace = False
mock_args.append = True
mock_args.overwrite = False

publish_mode = publish_command.PublishCommand.get_publish_mode(mock_args, mock_logger)
self.assertEqual(publish_mode, TSC.Server.PublishMode.Append)

def test_overwrite_publish_mode(self, mock_session, mock_server):
def test_overwrite_publish_mode(self, mock_path, mock_glob, mock_session):
mock_args.replace = False
mock_args.append = False
mock_args.overwrite = True

publish_mode = publish_command.PublishCommand.get_publish_mode(mock_args, mock_logger)
self.assertEqual(publish_mode, TSC.Server.PublishMode.Overwrite)

def test_invalid_combination_of_modes(self, mock_session, mock_server):
def test_invalid_combination_of_modes(self, mock_path, mock_glob, mock_session):
mock_args.replace = True
mock_args.append = True
mock_args.overwrite = False
Expand Down
Loading