Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ochiu committed Nov 9, 2023
1 parent 5fe310a commit b81d3bb
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
1 change: 0 additions & 1 deletion pay-api/src/pay_api/models/eft_short_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@


from .base_model import VersionedModel
from .base_schema import BaseSchema
from .db import db


Expand Down
6 changes: 2 additions & 4 deletions pay-api/src/pay_api/resources/v1/eft_short_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@
from flask import Blueprint, current_app, jsonify, request
from flask_cors import cross_origin

from pay_api.exceptions import BusinessException, error_to_response
from pay_api.schemas import utils as schema_utils
from pay_api.exceptions import BusinessException
from pay_api.services.eft_short_names import EFTShortnames as EFTShortnameService
from pay_api.utils.auth import jwt as _jwt
from pay_api.utils.endpoints_enums import EndpointEnum
from pay_api.utils.enums import Role
from pay_api.utils.errors import Error
from pay_api.utils.trace import tracing as _tracing

bp = Blueprint('EFT_SHORT_NAMES', __name__, url_prefix=f'{EndpointEnum.API_V1.value}/eft-shortnames')
Expand Down Expand Up @@ -74,7 +72,7 @@ def patch_eft_shortname(short_name_id: int):
request_json = request.get_json()

try:
if not (EFTShortnameService.find_by_short_name_id(short_name_id)):
if not EFTShortnameService.find_by_short_name_id(short_name_id):
response, status = {'message': 'The requested EFT short name could not be found.'}, \
HTTPStatus.NOT_FOUND
else:
Expand Down
2 changes: 1 addition & 1 deletion pay-api/src/pay_api/services/eft_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def create_payment(self, payment_account: PaymentAccountModel, invoice: InvoiceM
@staticmethod
def create_invoice_reference(invoice: InvoiceModel, payment: PaymentModel) -> InvoiceReferenceModel:
"""Create an invoice reference record."""
if not(invoice_reference := InvoiceReferenceModel
if not (invoice_reference := InvoiceReferenceModel
.find_any_active_reference_by_invoice_number(payment.invoice_number)):
invoice_reference = InvoiceReferenceModel()

Expand Down
8 changes: 4 additions & 4 deletions pay-api/tests/unit/api/test_eft_short_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from pay_api.models import Receipt as ReceiptModel
from pay_api.utils.enums import InvoiceReferenceStatus, InvoiceStatus, PaymentMethod, PaymentStatus, Role
from tests.utilities.base_test import (
factory_invoice, factory_payment_account, get_claims, token_header, factory_eft_shortname)
factory_eft_shortname, factory_invoice, factory_payment_account, get_claims, token_header)


def test_patch_eft_short_name(session, client, jwt, app):
Expand All @@ -39,7 +39,7 @@ def test_patch_eft_short_name(session, client, jwt, app):
auth_account_id='1234').save()

short_name = factory_eft_shortname(short_name='TESTSHORTNAME').save()
rv = client.patch(f"/api/v1/eft-shortnames/{short_name.id}",
rv = client.patch(f'/api/v1/eft-shortnames/{short_name.id}',
data=json.dumps({'accountId': '1234'}),
headers=headers)
shortname_dict = rv.json
Expand Down Expand Up @@ -91,7 +91,7 @@ def test_search_eft_short_names(session, client, jwt, app):

# create test data
factory_eft_shortname(short_name='TESTSHORTNAME1').save()
factory_eft_shortname(short_name='TESTSHORTNAME2', auth_account_id="1234").save()
factory_eft_shortname(short_name='TESTSHORTNAME2', auth_account_id='1234').save()

# Assert search returns default unmapped short names
rv = client.get('/api/v1/eft-shortnames', headers=headers)
Expand Down Expand Up @@ -167,7 +167,7 @@ def test_apply_eft_short_name_credits(session, client, jwt, app):
eft_credit_2.short_name_id = short_name.id
eft_credit_2.save()

rv = client.patch(f"/api/v1/eft-shortnames/{short_name.id}",
rv = client.patch(f'/api/v1/eft-shortnames/{short_name.id}',
data=json.dumps({'accountId': '1234'}),
headers=headers)
shortname_dict = rv.json
Expand Down
5 changes: 3 additions & 2 deletions pay-api/tests/utilities/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@
from faker import Faker

from pay_api.models import (
CfsAccount, Comment, DistributionCode, Invoice, InvoiceReference, Payment, PaymentAccount, PaymentLineItem,
PaymentTransaction, Receipt, RoutingSlip, Statement, StatementInvoices, StatementSettings, EFTShortnames)
CfsAccount, Comment, DistributionCode, EFTShortnames, Invoice, InvoiceReference, Payment, PaymentAccount,
PaymentLineItem, PaymentTransaction, Receipt, RoutingSlip, Statement, StatementInvoices, StatementSettings)
from pay_api.utils.constants import DT_SHORT_FORMAT
from pay_api.utils.enums import (
CfsAccountStatus, InvoiceReferenceStatus, InvoiceStatus, LineItemStatus, PaymentMethod, PaymentStatus,
PaymentSystem, Role, RoutingSlipStatus)


token_header = {
'alg': 'RS256',
'typ': 'JWT',
Expand Down

0 comments on commit b81d3bb

Please sign in to comment.