-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1452c86
commit b62393e
Showing
2 changed files
with
50 additions
and
1 deletion.
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
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,9 +1,34 @@ | ||
"""Test file for report.py""" | ||
|
||
import requests | ||
import requests_mock | ||
|
||
from fusion.fusion import Fusion | ||
from fusion.report import Report | ||
|
||
|
||
def test_report_class_object_representation() -> None: | ||
"""Test the object representation of the Report class.""" | ||
report = Report(identifier="my_report", report={"key": "value"}) | ||
assert repr(report) | ||
assert repr(report) | ||
|
||
def test_add_registered_attribute(requests_mock: requests_mock.Mocker, fusion_obj: Fusion) -> None: | ||
"""Test the add_registered_attribute method.""" | ||
catalog = "my_catalog" | ||
report = "TEST_REPORT" | ||
attribute_identifier = "my_attribute" | ||
url = f"{fusion_obj.root_url}catalogs/{catalog}/datasets/{report}/attributes/{attribute_identifier}/registration" | ||
|
||
requests_mock.post(url, json={"isCriticalDataElement": True}) | ||
|
||
report_obj = Report(identifier="TEST_REPORT") | ||
report_obj.client = fusion_obj | ||
resp = report_obj.add_registered_attribute( | ||
attribute_identifier="my_attribute", | ||
is_kde=True, | ||
catalog=catalog, | ||
return_resp_obj=True | ||
) | ||
assert isinstance(resp, requests.Response) | ||
status_code = 200 | ||
assert resp.status_code == status_code |