-
Notifications
You must be signed in to change notification settings - Fork 4
Testing Beta URL by adding environment var in tox #55
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
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e2596d5
Set api env var to beta api
akash5100 8131c0f
update testcases to test beta url
akash5100 36dc528
Merge branch 'Helioviewer-Project:main' into config
akash5100 6968c08
update testcases to test beta url
akash5100 fb2d080
suggested changes
akash5100 daaf014
pytest fixtures for repeating parameters
akash5100 2a24254
Add datetime to confest and update dev_guides
akash5100 107828e
Merge branch 'main' into config
akash5100 2ae3cde
Remove hardcoded datetime from examples docstrings
akash5100 f7e6f4c
Merge branch 'config' of github.com:akash5100/python-api into config
akash5100 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,75 +1,75 @@ | ||
| from datetime import datetime | ||
|
|
||
| import pytest | ||
|
|
||
| from hvpy import getJPX | ||
| from hvpy.api_groups.jpeg2000.get_jpx import getJPXInputParameters | ||
|
|
||
|
|
||
| def test_raw_response(): | ||
| def test_raw_response(start_time, end_time): | ||
| response = getJPX( | ||
| startTime=datetime(2014, 1, 1, 0, 0, 0), | ||
| endTime=datetime(2014, 1, 1, 0, 45, 0), | ||
| startTime=start_time, | ||
| endTime=end_time, | ||
| sourceId=14, | ||
| linked=False, | ||
| verbose=False, | ||
| jpip=False, | ||
| cadence=None, | ||
| cadence=60, | ||
| ) | ||
| assert isinstance(response, bytes) | ||
|
|
||
|
|
||
| def test_str_response(): | ||
| def test_str_response(start_time, end_time): | ||
| response = getJPX( | ||
| startTime=datetime(2014, 1, 1, 0, 0, 0), | ||
| endTime=datetime(2014, 1, 1, 0, 45, 0), | ||
| startTime=start_time, | ||
| endTime=end_time, | ||
| sourceId=14, | ||
| linked=False, | ||
| verbose=False, | ||
| jpip=True, | ||
| cadence=None, | ||
| cadence=60, | ||
| ) | ||
| assert isinstance(response, str) | ||
| assert response.startswith("jpip://") | ||
|
|
||
|
|
||
| def test_json_response(): | ||
| def test_json_response(start_time, end_time): | ||
| response = getJPX( | ||
| startTime=datetime(2014, 1, 1, 0, 0, 0), | ||
| endTime=datetime(2014, 1, 1, 0, 45, 0), | ||
| startTime=start_time, | ||
| endTime=end_time, | ||
| sourceId=14, | ||
| linked=False, | ||
| verbose=True, | ||
| jpip=True, | ||
| cadence=None, | ||
| cadence=60, | ||
| ) | ||
| assert isinstance(response, dict) | ||
| assert response["uri"].startswith("jpip://") | ||
|
|
||
| response = getJPX( | ||
| startTime=datetime(2014, 1, 1, 0, 0, 0), | ||
| endTime=datetime(2014, 1, 1, 0, 45, 0), | ||
| startTime=start_time, | ||
| endTime=end_time, | ||
| sourceId=14, | ||
| linked=False, | ||
| verbose=True, | ||
| jpip=False, | ||
| cadence=None, | ||
| cadence=60, | ||
| ) | ||
| assert isinstance(response, dict) | ||
| assert response["uri"].startswith("https://") | ||
|
|
||
|
|
||
| def test_error_handling(): | ||
| def test_error_handling(start_time, end_time): | ||
| with pytest.raises(TypeError, match="missing 1 required positional argument: 'startTime'"): | ||
| getJPX(endTime=datetime(2014, 1, 1, 0, 45, 0), sourceId=14) | ||
| getJPX(endTime=end_time, sourceId=14) | ||
| with pytest.raises(TypeError, match="missing 1 required positional argument: 'endTime'"): | ||
| getJPX(startTime=datetime(2014, 1, 1, 0, 0, 0), sourceId=14) | ||
| getJPX(startTime=start_time, sourceId=14) | ||
| with pytest.raises(TypeError, match="missing 1 required positional argument: 'sourceId'"): | ||
| getJPX(startTime=datetime(2014, 1, 1, 0, 0, 0), endTime=datetime(2014, 1, 1, 0, 45, 0)) | ||
| getJPX(startTime=start_time, endTime=end_time) | ||
|
|
||
|
|
||
| def test_url_property(): | ||
| def test_url_property(start_time, end_time): | ||
| params = getJPXInputParameters( | ||
| startTime=datetime(2014, 1, 1, 0, 0, 0), endTime=datetime(2014, 1, 1, 0, 45, 0), sourceId=14 | ||
| startTime=start_time, | ||
| endTime=end_time, | ||
| sourceId=14, | ||
| ) | ||
| assert params.url == "https://api.helioviewer.org/v2/getJPX/" | ||
| assert params.url == "https://api.beta.helioviewer.org/v2/getJPX/" |
33 changes: 14 additions & 19 deletions
33
hvpy/api_groups/jpeg2000/tests/test_get_jpx_closest_to_mid_point.py
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 |
|---|---|---|
| @@ -1,52 +1,47 @@ | ||
| from datetime import datetime | ||
|
|
||
| import pytest | ||
|
|
||
| from hvpy import getJPXClosestToMidPoint | ||
| from hvpy.api_groups.jpeg2000.get_jpx_closest_to_mid_point import getJPXClosestToMidPointInputParameters | ||
|
|
||
| startTimes = [datetime(2014, 1, 1, 0, 0, 0), datetime(2014, 1, 1, 2, 3, 3), datetime(2014, 1, 1, 4, 5, 5)] | ||
| endTimes = [datetime(2014, 1, 1, 0, 45, 0), datetime(2014, 1, 1, 2, 33, 3), datetime(2014, 1, 1, 4, 54, 5)] | ||
|
|
||
|
|
||
| def test_raw_response(): | ||
| def test_raw_response(start_times, end_times): | ||
| response = getJPXClosestToMidPoint( | ||
| startTimes=startTimes, endTimes=endTimes, sourceId=14, linked=False, verbose=False, jpip=False | ||
| startTimes=start_times, endTimes=end_times, sourceId=14, linked=False, verbose=False, jpip=False | ||
| ) | ||
| assert isinstance(response, bytes) | ||
|
|
||
|
|
||
| def test_str_response(): | ||
| def test_str_response(start_times, end_times): | ||
| response = getJPXClosestToMidPoint( | ||
| startTimes=startTimes, endTimes=endTimes, sourceId=14, linked=False, verbose=False, jpip=True | ||
| startTimes=start_times, endTimes=end_times, sourceId=14, linked=False, verbose=False, jpip=True | ||
| ) | ||
| assert isinstance(response, str) | ||
| assert response.startswith("jpip://") | ||
|
|
||
|
|
||
| def test_json_response(): | ||
| def test_json_response(start_times, end_times): | ||
| response = getJPXClosestToMidPoint( | ||
| startTimes=startTimes, endTimes=endTimes, sourceId=14, linked=False, verbose=True, jpip=True | ||
| startTimes=start_times, endTimes=end_times, sourceId=14, linked=False, verbose=True, jpip=True | ||
| ) | ||
| assert isinstance(response, dict) | ||
| assert response["uri"].startswith("jpip://") | ||
|
|
||
| response = getJPXClosestToMidPoint( | ||
| startTimes=startTimes, endTimes=endTimes, sourceId=14, linked=False, verbose=True, jpip=False | ||
| startTimes=start_times, endTimes=end_times, sourceId=14, linked=False, verbose=True, jpip=False | ||
| ) | ||
| assert isinstance(response, dict) | ||
| assert response["uri"].startswith("https://") | ||
|
|
||
|
|
||
| def test_error_handling(): | ||
| def test_error_handling(start_times, end_times): | ||
| with pytest.raises(TypeError, match="missing 1 required positional argument: 'startTimes'"): | ||
| getJPXClosestToMidPoint(endTimes=endTimes, sourceId=14) | ||
| getJPXClosestToMidPoint(endTimes=end_times, sourceId=14) | ||
| with pytest.raises(TypeError, match="missing 1 required positional argument: 'endTimes'"): | ||
| getJPXClosestToMidPoint(startTimes=startTimes, sourceId=14) | ||
| getJPXClosestToMidPoint(startTimes=start_times, sourceId=14) | ||
| with pytest.raises(TypeError, match="missing 1 required positional argument: 'sourceId'"): | ||
| getJPXClosestToMidPoint(startTimes=startTimes, endTimes=endTimes) | ||
| getJPXClosestToMidPoint(startTimes=start_times, endTimes=end_times) | ||
|
|
||
|
|
||
| def test_url_property(): | ||
| params = getJPXClosestToMidPointInputParameters(startTimes=startTimes, endTimes=endTimes, sourceId=14) | ||
| assert params.url == "https://api.helioviewer.org/v2/getJPXClosestToMidPoint/" | ||
| def test_url_property(start_times, end_times): | ||
| params = getJPXClosestToMidPointInputParameters(startTimes=start_times, endTimes=end_times, sourceId=14) | ||
| assert params.url == "https://api.beta.helioviewer.org/v2/getJPXClosestToMidPoint/" |
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
20 changes: 9 additions & 11 deletions
20
hvpy/api_groups/official_clients/tests/test_get_closest_image.py
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 |
|---|---|---|
| @@ -1,29 +1,27 @@ | ||
| from datetime import datetime | ||
|
|
||
| import pytest | ||
|
|
||
| from hvpy import getClosestImage | ||
| from hvpy.api_groups.official_clients.get_closest_image import getClosestImageInputParameters | ||
|
|
||
|
|
||
| def test_json_res(): | ||
| response = getClosestImage(date=datetime(2014, 1, 1, 23, 59, 59), sourceId=14) | ||
| def test_json_res(date): | ||
| response = getClosestImage(date=date, sourceId=14) | ||
| assert isinstance(response, dict) | ||
|
|
||
|
|
||
| def test_str_res(): | ||
| response = getClosestImage(date=datetime(2014, 1, 1, 23, 59, 59), sourceId=14, callback="callback") | ||
| def test_str_res(date): | ||
| response = getClosestImage(date=date, sourceId=14, callback="callback") | ||
| assert isinstance(response, str) | ||
| assert response.startswith("callback") | ||
|
|
||
|
|
||
| def test_error_handling(): | ||
| def test_error_handling(date): | ||
| with pytest.raises(TypeError, match="missing 1 required positional argument: 'date'"): | ||
| getClosestImage(sourceId=14) | ||
| with pytest.raises(TypeError, match="missing 1 required positional argument: 'sourceId'"): | ||
| getClosestImage(date=datetime(2014, 1, 1, 23, 59, 59)) | ||
| getClosestImage(date=date) | ||
|
|
||
|
|
||
| def test_url_property(): | ||
| params = getClosestImageInputParameters(date=datetime(2014, 1, 1, 23, 59, 59), sourceId=14) | ||
| assert params.url == "https://api.helioviewer.org/v2/getClosestImage/" | ||
| def test_url_property(date): | ||
| params = getClosestImageInputParameters(date=date, sourceId=14) | ||
| assert params.url == "https://api.beta.helioviewer.org/v2/getClosestImage/" |
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
Oops, something went wrong.
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.