Skip to content
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

Release v7.0.1 #288

Merged
merged 6 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ on:

jobs:
call-changelog-check-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected].1
uses: ASFHyP3/actions/.github/workflows/[email protected].2
2 changes: 1 addition & 1 deletion .github/workflows/create-jira-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
call-create-jira-issue-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected].1
uses: ASFHyP3/actions/.github/workflows/[email protected].2
secrets:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/distribute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
call-version-info-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected].1
uses: ASFHyP3/actions/.github/workflows/[email protected].2
with:
python_version: "3.10"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labeled-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ on:

jobs:
call-labeled-pr-check-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected].1
uses: ASFHyP3/actions/.github/workflows/[email protected].2
2 changes: 1 addition & 1 deletion .github/workflows/release-template-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
call-release-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected].1
uses: ASFHyP3/actions/.github/workflows/[email protected].2
permissions:
pull-requests: write
secrets:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
call-release-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected].1
uses: ASFHyP3/actions/.github/workflows/[email protected].2
with:
release_prefix: HyP3 SDK
secrets:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on: push

jobs:
call-flake8-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected].1
uses: ASFHyP3/actions/.github/workflows/[email protected].2
with:
local_package_names: hyp3_sdk

call-secrets-analysis-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected].1
uses: ASFHyP3/actions/.github/workflows/[email protected].2
2 changes: 1 addition & 1 deletion .github/workflows/tag-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ on:

jobs:
call-bump-version-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected].1
uses: ASFHyP3/actions/.github/workflows/[email protected].2
secrets:
USER_TOKEN: ${{ secrets.TOOLS_BOT_PAK }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

jobs:
call-pytest-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected].1
uses: ASFHyP3/actions/.github/workflows/[email protected].2
with:
local_package_name: hyp3_sdk
python_versions: >-
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/ASFHyP3/hyp3-sdk/pull/276>). This feature had unintended consequences which broke some processing pipelines that rely on the HyP3 SDK (see <https://github.com/ASFHyP3/hyp3-sdk/issues/285> for more details).

## [7.0.0]

### Removed
Expand Down
14 changes: 0 additions & 14 deletions src/hyp3_sdk/hyp3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 2 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
39 changes: 0 additions & 39 deletions tests/test_hyp3.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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}
Expand Down