Skip to content

Commit

Permalink
Fix deps (#1220)
Browse files Browse the repository at this point in the history
* Fix deps

* Fix deps, tie jsonschema to 4.17.3

* Fix pay-admin requirements

* Small unit test fixes - use local time for first and last dates of the month.

* Fix unit test
  • Loading branch information
seeker25 authored Aug 1, 2023
1 parent 6d9c2ff commit e62bd32
Show file tree
Hide file tree
Showing 19 changed files with 26 additions and 23 deletions.
2 changes: 1 addition & 1 deletion bcol-api/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ aniso8601==9.0.1
attrs==22.1.0
blinker==1.5
cachelib==0.9.0
certifi==2022.12.7
certifi==2023.7.22
charset-normalizer==2.1.1
click==8.1.3
ecdsa==0.18.0
Expand Down
2 changes: 1 addition & 1 deletion bcol-api/requirements/prod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ flask-restx
flask-jwt-oidc
python-dotenv
psycopg2-binary
jsonschema
jsonschema==4.17.3
requests
zeep
python-ldap
Expand Down
2 changes: 1 addition & 1 deletion jobs/ftp-poller/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Werkzeug==1.0.1
aniso8601==9.0.1
attrs==23.1.0
bcrypt==4.0.1
certifi==2023.5.7
certifi==2023.7.22
cffi==1.15.1
charset-normalizer==3.1.0
click==8.1.3
Expand Down
2 changes: 1 addition & 1 deletion jobs/ftp-poller/requirements/prod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Flask
Flask-RESTplus
python-dotenv
psycopg2-binary
jsonschema
jsonschema==4.17.3
requests
Werkzeug<2
pysftp
Expand Down
2 changes: 1 addition & 1 deletion jobs/notebook-report/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ python-dotenv==0.13.0
requests==2.31.0
marshmallow==2.20.5
Werkzeug==0.16.1
certifi==2020.4.5.1
certifi==2023.7.22
urllib3==1.25.9
idna==2.9
pylint
4 changes: 2 additions & 2 deletions jobs/notebook-report/requirements/prod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ python-dotenv==0.13.0
requests==2.31.0
marshmallow==2.20.5
Werkzeug==0.16.1
certifi==2020.4.5.1
certifi==2023.7.22
urllib3==1.25.9
idna==2.9
idna==2.9
2 changes: 1 addition & 1 deletion jobs/payment-jobs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ blinker==1.6.2
cachelib==0.9.0
cachetools==5.3.1
cattrs==23.1.2
certifi==2023.5.7
certifi==2023.7.22
cffi==1.15.1
charset-normalizer==3.1.0
click==8.1.3
Expand Down
2 changes: 1 addition & 1 deletion jobs/payment-jobs/requirements/prod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ flask-marshmallow==0.11.0
marshmallow-sqlalchemy==0.25.0
python-dotenv
psycopg2-binary
jsonschema
jsonschema==4.17.3
requests
Werkzeug<2
jaeger-client
Expand Down
2 changes: 1 addition & 1 deletion pay-admin/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ MarkupSafe==2.1.1
SQLAlchemy==1.3.24
WTForms==3.0.1
Werkzeug==1.0.1
certifi==2022.12.7
certifi==2023.7.22
charset-normalizer==2.0.12
click==8.1.3
flask-oidc==1.4.0
Expand Down
1 change: 1 addition & 0 deletions pay-admin/requirements/repo-libraries.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
-e git+https://github.com/bcgov/sbc-pay.git@main#egg=pay-api&subdirectory=pay-api
-e git+https://github.com/bcgov/sbc-common-components.git#egg=sbc-common-components&subdirectory=python
git+https://github.com/daxiom/simple-cloudevent.py.git
2 changes: 1 addition & 1 deletion pay-api/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ backports.zoneinfo==0.2.1
blinker==1.6.2
cachelib==0.9.0
cattrs==22.2.0
certifi==2022.12.7
certifi==2023.7.22
cffi==1.15.1
charset-normalizer==3.1.0
click==8.1.3
Expand Down
10 changes: 5 additions & 5 deletions pay-api/src/pay_api/utils/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def get_week_start_and_end_date(target_date: datetime = datetime.now(), index: i

def get_first_and_last_dates_of_month(month: int, year: int):
"""Return first and last dates for a given month and year."""
start_date = datetime.now().replace(day=1, year=year, month=month)
start_date = current_local_time().replace(day=1, year=year, month=month)
end_date = start_date.replace(day=calendar.monthrange(year=year, month=month)[1])
return start_date, end_date

Expand Down Expand Up @@ -120,15 +120,15 @@ def parse_url_params(url_params: str) -> Dict:
return parsed_url


def current_local_time() -> datetime:
def current_local_time(timezone_override=None) -> datetime:
"""Return current local time."""
today = datetime.now()
return get_local_time(today)
return get_local_time(today, timezone_override)


def get_local_time(date_val: datetime):
def get_local_time(date_val: datetime, timezone_override=None):
"""Return local time value."""
tz_name = current_app.config['LEGISLATIVE_TIMEZONE']
tz_name = timezone_override or current_app.config['LEGISLATIVE_TIMEZONE']
tz_local = pytz.timezone(tz_name)
date_val = date_val.astimezone(tz_local)
return date_val
Expand Down
4 changes: 3 additions & 1 deletion pay-api/tests/unit/services/test_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from pay_api.models.payment_account import PaymentAccount
from pay_api.services.payment import Payment as Payment_service
from pay_api.utils.enums import InvoiceReferenceStatus, InvoiceStatus, PaymentMethod
from pay_api.utils.util import current_local_time
from tests.utilities.base_test import \
(factory_invoice, factory_invoice_reference, factory_payment,
factory_payment_account, factory_payment_line_item, factory_usd_payment)
Expand Down Expand Up @@ -85,7 +86,8 @@ def test_payment_with_no_active_invoice(session):
False, 3, None, None),
('week_no_match', {'weekFilter': {'index': 2}}, False, 0, None, None),
('week_match_all', {'weekFilter': {'index': 0}}, False, 3, None, None),
('month', {'monthFilter': {'month': datetime.now().month, 'year': datetime.now().year}},
('month', {'monthFilter': {'month': current_local_time('America/Vancouver').month,
'year': current_local_time('America/Vancouver').year}},
False, 3, None, None),
('created_by', {'createdBy': '1'}, False, 1, 'created_by', 'test'),
('created_name', {'createdName': '1'}, False, 1, 'created_name', '1'),
Expand Down
2 changes: 1 addition & 1 deletion queue_services/events-listener/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ asyncio-nats-client==0.11.5
asyncio-nats-streaming==0.4.0
attrs==23.1.0
blinker==1.6.2
certifi==2023.5.7
certifi==2023.7.22
click==8.1.3
expiringdict==1.2.2
importlib-resources==5.12.0
Expand Down
2 changes: 1 addition & 1 deletion queue_services/events-listener/requirements/prod.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Flask
jsonschema
jsonschema==4.17.3
python-dotenv
sentry-sdk[flask]
asyncio-nats-client
Expand Down
2 changes: 1 addition & 1 deletion queue_services/payment-reconciliations/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ blinker==1.6.2
cachelib==0.9.0
cachetools==5.3.1
cattrs==23.1.2
certifi==2023.5.7
certifi==2023.7.22
cffi==1.15.1
charset-normalizer==3.1.0
click==8.1.3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Flask
jsonschema
jsonschema==4.17.3
python-dotenv
sentry-sdk[flask]
asyncio-nats-client
Expand Down
2 changes: 1 addition & 1 deletion report-api/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ attrs==22.2.0
blinker==1.6.1
cachelib==0.10.2
cairocffi==1.5.0
certifi==2022.12.7
certifi==2023.7.22
cffi==1.15.1
charset-normalizer==3.1.0
click==8.1.3
Expand Down
2 changes: 1 addition & 1 deletion report-api/requirements/prod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ python-dateutil
flask-jwt-oidc
python-dotenv
psycopg2-binary
jsonschema
jsonschema==4.17.3
requests
cairocffi>=0.9.0
flask-jwt-oidc
Expand Down

0 comments on commit e62bd32

Please sign in to comment.