diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index f7db34a..22052c3 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -12,4 +12,4 @@ on: jobs: call-changelog-check-workflow: - uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@v0.11.1 + uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@v0.11.2 diff --git a/.github/workflows/create-jira-issue.yml b/.github/workflows/create-jira-issue.yml index 129ff5f..99489d5 100644 --- a/.github/workflows/create-jira-issue.yml +++ b/.github/workflows/create-jira-issue.yml @@ -6,7 +6,7 @@ on: jobs: call-create-jira-issue-workflow: - uses: ASFHyP3/actions/.github/workflows/reusable-create-jira-issue.yml@v0.11.1 + uses: ASFHyP3/actions/.github/workflows/reusable-create-jira-issue.yml@v0.11.2 secrets: JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} diff --git a/.github/workflows/distribute.yml b/.github/workflows/distribute.yml index 3c79cf4..fe9485c 100644 --- a/.github/workflows/distribute.yml +++ b/.github/workflows/distribute.yml @@ -7,7 +7,7 @@ on: jobs: call-version-info-workflow: - uses: ASFHyP3/actions/.github/workflows/reusable-version-info.yml@v0.11.1 + uses: ASFHyP3/actions/.github/workflows/reusable-version-info.yml@v0.11.2 with: python_version: "3.10" diff --git a/.github/workflows/labeled-pr.yml b/.github/workflows/labeled-pr.yml index 3ba2160..f89f3e3 100644 --- a/.github/workflows/labeled-pr.yml +++ b/.github/workflows/labeled-pr.yml @@ -12,4 +12,4 @@ on: jobs: call-labeled-pr-check-workflow: - uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.11.1 + uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.11.2 diff --git a/.github/workflows/release-template-comment.yml b/.github/workflows/release-template-comment.yml index 702a0e6..2e12712 100644 --- a/.github/workflows/release-template-comment.yml +++ b/.github/workflows/release-template-comment.yml @@ -7,7 +7,7 @@ on: jobs: call-release-workflow: - uses: ASFHyP3/actions/.github/workflows/reusable-release-checklist-comment.yml@v0.11.1 + uses: ASFHyP3/actions/.github/workflows/reusable-release-checklist-comment.yml@v0.11.2 permissions: pull-requests: write secrets: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 65d18eb..d4c54ea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ on: jobs: call-release-workflow: - uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.11.1 + uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.11.2 with: release_prefix: HyP3 SDK secrets: diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 555015d..bfb8f53 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -4,9 +4,9 @@ on: push jobs: call-flake8-workflow: - uses: ASFHyP3/actions/.github/workflows/reusable-flake8.yml@v0.11.1 + uses: ASFHyP3/actions/.github/workflows/reusable-flake8.yml@v0.11.2 with: local_package_names: hyp3_sdk call-secrets-analysis-workflow: - uses: ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml@v0.11.1 + uses: ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml@v0.11.2 diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml index 7bc7924..3b94479 100644 --- a/.github/workflows/tag-version.yml +++ b/.github/workflows/tag-version.yml @@ -7,6 +7,6 @@ on: jobs: call-bump-version-workflow: - uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.11.1 + uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.11.2 secrets: USER_TOKEN: ${{ secrets.TOOLS_BOT_PAK }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b83c95e..ebfa764 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ on: jobs: call-pytest-workflow: - uses: ASFHyP3/actions/.github/workflows/reusable-pytest.yml@v0.11.1 + uses: ASFHyP3/actions/.github/workflows/reusable-pytest.yml@v0.11.2 with: local_package_name: hyp3_sdk python_versions: >- diff --git a/CHANGELOG.md b/CHANGELOG.md index ad77ad1..8c21841 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/) and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [7.0.1] + +### Removed +* Removed the unapproved user warning implemented in [v6.2.0](https://github.com/ASFHyP3/hyp3-sdk/releases/tag/v6.2.0) (see ). This feature had unintended consequences which broke some processing pipelines that rely on the HyP3 SDK (see for more details). + ## [7.0.0] ### Removed diff --git a/src/hyp3_sdk/hyp3.py b/src/hyp3_sdk/hyp3.py index ab9d97a..4f653cc 100644 --- a/src/hyp3_sdk/hyp3.py +++ b/src/hyp3_sdk/hyp3.py @@ -46,20 +46,6 @@ def __init__(self, api_url: str = PROD_API, username: Optional[str] = None, pass self.session = hyp3_sdk.util.get_authenticated_session(username, password) self.session.headers.update({'User-Agent': f'{hyp3_sdk.__name__}/{hyp3_sdk.__version__}'}) - self._check_application_status() - - def _check_application_status(self) -> None: - help_url = 'https://hyp3-docs.asf.alaska.edu/using/requesting_access' - info = self.my_info() - if info['application_status'] == 'NOT_STARTED': - warnings.warn(f'User {info["user_id"]} has not yet applied for a monthly credit allotment.' - f' Please visit {help_url} to submit your application.') - if info['application_status'] == 'PENDING': - warnings.warn(f'User {info["user_id"]}\'s request for access is pending review. For more information, ' - f'visit {help_url}') - if info['application_status'] == 'REJECTED': - warnings.warn(f'{info["user_id"]}\'s request for access has been rejected. For more information, ' - f'visit {help_url}') def find_jobs(self, start: Optional[datetime] = None, diff --git a/tests/conftest.py b/tests/conftest.py index 9c7d68c..3e699d9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -13,16 +13,12 @@ @pytest.fixture(autouse=True) def get_mock_hyp3(): - def mock_my_info(self): - return {'application_status': 'APPROVED'} - def mock_get_authenticated_session(username, password): return requests.Session() def default_hyp3(): - with patch('hyp3_sdk.hyp3.HyP3.my_info', mock_my_info): - with patch('hyp3_sdk.util.get_authenticated_session', mock_get_authenticated_session): - return HyP3() + with patch('hyp3_sdk.util.get_authenticated_session', mock_get_authenticated_session): + return HyP3() return default_hyp3 diff --git a/tests/test_hyp3.py b/tests/test_hyp3.py index aa60407..25086f8 100644 --- a/tests/test_hyp3.py +++ b/tests/test_hyp3.py @@ -1,10 +1,8 @@ import math import warnings from datetime import datetime, timedelta, timezone -from unittest.mock import patch from urllib.parse import urljoin -import requests import responses import hyp3_sdk @@ -417,43 +415,6 @@ def test_check_credits(get_mock_hyp3): assert math.isclose(api.check_credits(), 25.) -@responses.activate -def test_check_application_status_approved(get_mock_hyp3): - with warnings.catch_warnings(record=True) as w: - _ = get_mock_hyp3() - assert len(w) == 0 - - -@responses.activate -def test_check_application_status_errors(get_mock_hyp3): - application_status = 'NOT_STARTED' - with warnings.catch_warnings(record=True) as w: - with patch('hyp3_sdk.hyp3.HyP3.my_info', lambda x: {'user_id': 'someUser', - 'application_status': application_status}): - with patch('hyp3_sdk.util.get_authenticated_session', lambda username, password: requests.Session()): - _ = HyP3() - assert len(w) == 1 - assert 'not yet applied for a monthly credit allotment' in str(w[0].message) - - application_status = 'PENDING' - with warnings.catch_warnings(record=True) as w: - with patch('hyp3_sdk.hyp3.HyP3.my_info', lambda x: {'user_id': 'someUser', - 'application_status': application_status}): - with patch('hyp3_sdk.util.get_authenticated_session', lambda username, password: requests.Session()): - _ = HyP3() - assert len(w) == 1 - assert 'request for access is pending review' in str(w[0].message) - - application_status = 'REJECTED' - with warnings.catch_warnings(record=True) as w: - with patch('hyp3_sdk.hyp3.HyP3.my_info', lambda x: {'user_id': 'someUser', - 'application_status': application_status}): - with patch('hyp3_sdk.util.get_authenticated_session', lambda username, password: requests.Session()): - _ = HyP3() - assert len(w) == 1 - assert 'request for access has been rejected' in str(w[0].message) - - @responses.activate def test_costs(get_mock_hyp3): api_response = {'foo': 5}