-
Notifications
You must be signed in to change notification settings - Fork 16
refreshextracts refreshes the wrong extract if you have multiple data sources with the same name and same Project name #376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jacalata
merged 7 commits into
development
from
jac/datasources-need-parent-project-path
Feb 13, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f3829df
Bump actions/checkout from 4 to 5 (#362)
dependabot[bot] e9c640c
Bump actions/setup-python from 5 to 6 (#363)
dependabot[bot] 3cd0265
Upload required file(s) for compliance
jimjag c10b67e
Update CODEOWNERS to remove '404: Not Found'
jimjag db8eaef
add parent project to the search for items
jacalata 2d73f49
add test
jacalata 8088aa5
address feedback from copilot
jacalata File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| #ECCN:Open Source |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| import pytest | ||
| import tableauserverclient as TSC | ||
|
|
||
| from tabcmd.commands.server import Server | ||
|
|
||
|
|
||
| class _Logger: | ||
| def debug(self, *_args, **_kwargs): | ||
| pass | ||
|
|
||
|
|
||
| class _DummyItem: | ||
| def __init__(self, name: str, project_id: str): | ||
| self.name = name | ||
| self.project_id = project_id | ||
|
|
||
|
|
||
| class _DummyPagination: | ||
| def __init__(self, total_available: int, page_number: int = 1, page_size: int = 100): | ||
| self.total_available = total_available | ||
| self.page_number = page_number | ||
| self.page_size = page_size | ||
|
|
||
|
|
||
| class _DatasourcesEndpoint: | ||
| def __init__(self, items): | ||
| self._items = items | ||
|
jacalata marked this conversation as resolved.
|
||
|
|
||
| def get(self, _req_option: TSC.RequestOptions): | ||
| # Ignore server-side filters for this unit test; we validate client-side disambiguation | ||
| return self._items, _DummyPagination(total_available=len(self._items)) | ||
|
|
||
|
|
||
|
jacalata marked this conversation as resolved.
|
||
| class _ProjectItem: | ||
| # Minimal project-like object carrying id/name used by Server.get_items_by_name | ||
| def __init__(self, project_id: str, name: str): | ||
| self.id = project_id | ||
| self.name = name | ||
|
|
||
|
|
||
| def test_filters_datasources_by_exact_project_id_when_container_provided(): | ||
| logger = _Logger() | ||
| container = _ProjectItem(project_id="proj-A", name="Shared") | ||
| # Two datasources with identical names, different project ownership | ||
| items = [ | ||
| _DummyItem(name="Sales", project_id="proj-A"), | ||
| _DummyItem(name="Sales", project_id="proj-B"), | ||
| ] | ||
| endpoint = _DatasourcesEndpoint(items) | ||
|
|
||
| results = Server.get_items_by_name(logger, endpoint, "Sales", container) | ||
|
|
||
| assert len(results) == 1 | ||
| assert results[0].project_id == "proj-A" | ||
|
|
||
|
|
||
| def test_raises_not_found_when_no_items_match_container_after_disambiguation(): | ||
| logger = _Logger() | ||
| container = _ProjectItem(project_id="proj-Z", name="Shared") | ||
| items = [ | ||
| _DummyItem(name="Sales", project_id="proj-A"), | ||
| _DummyItem(name="Sales", project_id="proj-B"), | ||
| ] | ||
| endpoint = _DatasourcesEndpoint(items) | ||
|
|
||
| with pytest.raises(TSC.ServerResponseError): | ||
| Server.get_items_by_name(logger, endpoint, "Sales", container) | ||
|
|
||
|
|
||
| def test_nested_projects_same_leaf_name_returns_correct_datasource_per_container(): | ||
| logger = _Logger() | ||
| # Simulate three separate 'Cats' projects that exist at different levels: | ||
| # MyProjects/ProjectA/Cats, MyProjects/ProjectB/Cats, and MyProjects/Cats | ||
| cats_under_project_a = _ProjectItem(project_id="cats-A", name="Cats") | ||
| cats_under_project_b = _ProjectItem(project_id="cats-B", name="Cats") | ||
| cats_under_root = _ProjectItem(project_id="cats-root", name="Cats") | ||
|
|
||
| # Three datasources all named identically but owned by different 'Cats' projects | ||
| items = [ | ||
| _DummyItem(name="my-datasource", project_id="cats-A"), | ||
| _DummyItem(name="my-datasource", project_id="cats-B"), | ||
| _DummyItem(name="my-datasource", project_id="cats-root"), | ||
| ] | ||
| endpoint = _DatasourcesEndpoint(items) | ||
|
|
||
| # Each lookup should return exactly one item from the target project id | ||
| res_a = Server.get_items_by_name(logger, endpoint, "my-datasource", cats_under_project_a) | ||
| assert len(res_a) == 1 and res_a[0].project_id == "cats-A" | ||
|
|
||
| res_b = Server.get_items_by_name(logger, endpoint, "my-datasource", cats_under_project_b) | ||
| assert len(res_b) == 1 and res_b[0].project_id == "cats-B" | ||
|
|
||
| res_root = Server.get_items_by_name(logger, endpoint, "my-datasource", cats_under_root) | ||
| assert len(res_root) == 1 and res_root[0].project_id == "cats-root" | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.