Skip to content

Commit

Permalink
changes for upgraded python version
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewPlayer3 committed Jun 28, 2024
1 parent fa73053 commit 49cc224
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
1 change: 1 addition & 0 deletions api/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
flask
flask_api
werkzeug<3
Flask-Cors
serverless_wsgi
./database
2 changes: 1 addition & 1 deletion api/src/api.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion find_new/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
asf-search==3.1.3
hyp3-sdk>=1.3.2
hyp3-sdk<6.1.0
python-dateutil
requests
./database
2 changes: 1 addition & 1 deletion harvest_products/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
hyp3-sdk>=1.3.2
hyp3-sdk<6.1.0
requests
./database
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
18 changes: 11 additions & 7 deletions tests/test_find_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': [
{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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'

0 comments on commit 49cc224

Please sign in to comment.