diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6caa3a6..bb7269d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -44,7 +44,7 @@ jobs: - uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: 3.12 - name: install dependencies and render templates run: | diff --git a/api/requirements.txt b/api/requirements.txt index 377078b..6b16147 100644 --- a/api/requirements.txt +++ b/api/requirements.txt @@ -1,5 +1,6 @@ flask flask_api +werkzeug<3 Flask-Cors serverless_wsgi ./database diff --git a/api/src/api.py b/api/src/api.py index fbf1fb2..1425a12 100644 --- a/api/src/api.py +++ b/api/src/api.py @@ -1,8 +1,8 @@ from datetime import datetime, timedelta, timezone from decimal import Decimal +from json import JSONEncoder from flask import Flask, abort, jsonify -from flask.json import JSONEncoder from flask_api.status import HTTP_404_NOT_FOUND from flask_cors import CORS from serverless_wsgi import handle_request diff --git a/find_new/requirements.txt b/find_new/requirements.txt index 582b272..9d136fb 100644 --- a/find_new/requirements.txt +++ b/find_new/requirements.txt @@ -1,5 +1,5 @@ asf-search==3.1.3 -hyp3-sdk>=1.3.2 +hyp3-sdk<6.1.0 python-dateutil requests ./database diff --git a/harvest_products/requirements.txt b/harvest_products/requirements.txt index 3e980bc..66ae3e9 100644 --- a/harvest_products/requirements.txt +++ b/harvest_products/requirements.txt @@ -1,3 +1,3 @@ -hyp3-sdk>=1.3.2 +hyp3-sdk<6.1.0 requests ./database diff --git a/tests/conftest.py b/tests/conftest.py index 341b939..a21df1c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,7 +5,7 @@ import pytest import yaml from botocore.stub import Stubber -from moto import mock_dynamodb2 +from moto import mock_aws import api import harvest_products @@ -23,7 +23,7 @@ def get_table_properties_from_template(resource_name): @pytest.fixture def tables(): - with mock_dynamodb2(): + with mock_aws(): database.DB = boto3.resource('dynamodb') class Tables: diff --git a/tests/test_find_new.py b/tests/test_find_new.py index 39f7e2f..b1edb91 100644 --- a/tests/test_find_new.py +++ b/tests/test_find_new.py @@ -338,7 +338,7 @@ def test_get_neighbors_max_neighbors_error(): @responses.activate def test_submit_jobs_for_granule(tables): - responses.add(responses.GET, AUTH_URL) + responses.add(responses.GET, AUTH_URL, json.dumps({})) mock_hyp3_response = { 'jobs': [ { @@ -393,6 +393,10 @@ def test_submit_jobs_for_granule(tables): } event_id = 'event_id1' + mock_user = {"user_id": "some_user"} + responses.add(responses.GET, environ['HYP3_URL'] + '/user', json.dumps(mock_user)) + + hyp3 = HyP3(environ['HYP3_URL'], username=environ['EDL_USERNAME'], password=environ['EDL_PASSWORD']) with patch('find_new.get_neighbors', lambda x: mock_neighbors): find_new.submit_jobs_for_granule(hyp3, event_id, granule) @@ -590,13 +594,13 @@ def test_lambda_handler(tables): assert len(products) == 5 - assert products[2]['job_type'] == 'RTC_GAMMA' + assert products[4]['job_type'] == 'RTC_GAMMA' + assert products[4]['granules'][0]['granule_name'] == 'granule3' + + assert products[2]['job_type'] == 'INSAR_GAMMA' assert products[2]['granules'][0]['granule_name'] == 'granule3' + assert products[2]['granules'][1]['granule_name'] == 'neighbor1' assert products[3]['job_type'] == 'INSAR_GAMMA' assert products[3]['granules'][0]['granule_name'] == 'granule3' - assert products[3]['granules'][1]['granule_name'] == 'neighbor1' - - assert products[4]['job_type'] == 'INSAR_GAMMA' - assert products[4]['granules'][0]['granule_name'] == 'granule3' - assert products[4]['granules'][1]['granule_name'] == 'neighbor2' + assert products[3]['granules'][1]['granule_name'] == 'neighbor2'