-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add get_catalog_store_urls + get_github_commit_url (#23)
* Add get_catalog_store_urls + get_github_commit_url * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix pre-commit stuff * Bugfix in get_catalog_store_urls * Make inject_attrs optional --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
b5762a1
commit 4bf7925
Showing
3 changed files
with
91 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
32 changes: 32 additions & 0 deletions
32
leap_data_management_utils/tests/test_data_management_transforms.py
This file contains 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 |
---|---|---|
@@ -1,4 +1,36 @@ | ||
from ruamel.yaml import YAML | ||
|
||
from leap_data_management_utils.data_management_transforms import ( | ||
get_catalog_store_urls, | ||
get_github_commit_url, | ||
) | ||
|
||
yaml = YAML(typ='safe') | ||
|
||
|
||
def test_smoke_test(): | ||
assert True | ||
# This is a bit dumb, but it at least checks the the imports are working | ||
# again super hard to test code involving bigquery here. | ||
|
||
|
||
def test_get_github_commit_url(): | ||
url = get_github_commit_url() | ||
assert url.startswith('https://github.com/leap-stc/leap-data-management-utils') | ||
|
||
|
||
def test_get_catalog_store_urls(tmp_path): | ||
# Create a temporary text file | ||
temp_file = tmp_path / 'some-name.yaml' | ||
data = { | ||
'stores': [{'id': 'a', 'url': 'a-url', 'some_other': 'stuff'}, {'id': 'b', 'url': 'b-url'}] | ||
} | ||
with open(temp_file, 'w') as f: | ||
yaml.dump(data, f) | ||
|
||
# Call the function to read the file | ||
content = get_catalog_store_urls(temp_file) | ||
|
||
# Assertions | ||
assert content['a'] == 'a-url' | ||
assert content['b'] == 'b-url' |
This file contains 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