From 40a4b473e57c665070b21cdf1fa564310ae81ff2 Mon Sep 17 00:00:00 2001 From: Rodrigo Barraza Date: Sun, 3 Dec 2023 18:51:54 -0800 Subject: [PATCH] Flake8 fixes --- pay-api/src/pay_api/models/non_sufficient_funds.py | 1 + pay-api/src/pay_api/services/non_sufficient_funds.py | 8 ++++---- pay-api/tests/unit/api/test_non_sufficient_funds.py | 3 +-- pay-api/tests/unit/models/test_non_sufficient_funds.py | 3 ++- pay-api/tests/unit/services/test_non_sufficient_funds.py | 6 +++--- pay-api/tests/utilities/base_test.py | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/pay-api/src/pay_api/models/non_sufficient_funds.py b/pay-api/src/pay_api/models/non_sufficient_funds.py index fee5c5d21..b87af99e4 100644 --- a/pay-api/src/pay_api/models/non_sufficient_funds.py +++ b/pay-api/src/pay_api/models/non_sufficient_funds.py @@ -54,6 +54,7 @@ class NonSufficientFundsSchema(BaseSchema): # pylint: disable=too-many-ancestor class Meta(BaseSchema.Meta): # pylint: disable=too-few-public-methods """Returns all the fields from the SQLAlchemy class.""" + model = NonSufficientFundsModel description = fields.String(data_key='description') diff --git a/pay-api/src/pay_api/services/non_sufficient_funds.py b/pay-api/src/pay_api/services/non_sufficient_funds.py index 7e21c1bc8..d7d1d46f0 100644 --- a/pay-api/src/pay_api/services/non_sufficient_funds.py +++ b/pay-api/src/pay_api/services/non_sufficient_funds.py @@ -18,14 +18,14 @@ from flask import current_app -from pay_api.models import NonSufficientFundsModel -from pay_api.models import NonSufficientFundsSchema from pay_api.models import InvoiceSchema +from pay_api.models import InvoiceReference as InvoiceReferenceModel from pay_api.models import Invoice as InvoiceModel +from pay_api.models import NonSufficientFundsModel +from pay_api.models import NonSufficientFundsSchema from pay_api.models import Payment as PaymentModel from pay_api.models import PaymentSchema from pay_api.models import PaymentAccount as PaymentAccountModel -from pay_api.models import InvoiceReference as InvoiceReferenceModel from pay_api.models import db @@ -136,7 +136,7 @@ def find_all_non_sufficient_funds_invoices(account_id: str, page: int, limit: in # pylint: disable=too-many-locals """Return all Non-Sufficient Funds.""" results, total = NonSufficientFundsService.query_all_non_sufficient_funds_invoices(account_id=account_id, - page=page, limit=limit) + page=page, limit=limit) data = { 'total': total, diff --git a/pay-api/tests/unit/api/test_non_sufficient_funds.py b/pay-api/tests/unit/api/test_non_sufficient_funds.py index a6f9adfff..08b944e0a 100644 --- a/pay-api/tests/unit/api/test_non_sufficient_funds.py +++ b/pay-api/tests/unit/api/test_non_sufficient_funds.py @@ -18,11 +18,10 @@ """ from pay_api.models import FeeSchedule from pay_api.models import PaymentAccount +from pay_api.utils.enums import InvoiceStatus from tests.utilities.base_test import ( factory_invoice_reference, factory_invoice, factory_non_sufficient_funds, factory_payment, factory_payment_account, factory_payment_line_item, get_claims, token_header) -from pay_api.utils.enums import ( - InvoiceStatus) def test_get_non_sufficient_funds(session, client, jwt, app): diff --git a/pay-api/tests/unit/models/test_non_sufficient_funds.py b/pay-api/tests/unit/models/test_non_sufficient_funds.py index 7a7c2261b..1e71adcb9 100644 --- a/pay-api/tests/unit/models/test_non_sufficient_funds.py +++ b/pay-api/tests/unit/models/test_non_sufficient_funds.py @@ -29,4 +29,5 @@ def test_non_sufficient_funds(session): assert non_sufficient_funds.id is not None assert non_sufficient_funds.invoice_id is not None - assert non_sufficient_funds.description is not None \ No newline at end of file + assert non_sufficient_funds.description is not None + \ No newline at end of file diff --git a/pay-api/tests/unit/services/test_non_sufficient_funds.py b/pay-api/tests/unit/services/test_non_sufficient_funds.py index 14a32cd4e..4bd3852db 100644 --- a/pay-api/tests/unit/services/test_non_sufficient_funds.py +++ b/pay-api/tests/unit/services/test_non_sufficient_funds.py @@ -19,11 +19,10 @@ from pay_api.models import FeeSchedule from pay_api.services import NonSufficientFundsService +from pay_api.utils.enums import InvoiceStatus from tests.utilities.base_test import ( factory_invoice_reference, factory_invoice, factory_non_sufficient_funds, factory_payment, factory_payment_account, factory_payment_line_item) -from pay_api.utils.enums import ( - InvoiceStatus) def test_save_non_sufficient_funds(session): @@ -33,11 +32,12 @@ def test_save_non_sufficient_funds(session): 'description': 'NSF', } non_sufficient_funds = NonSufficientFundsService.save_non_sufficient_funds(invoice_id=1, - description='NSF') + description='NSF') assert non_sufficient_funds assert non_sufficient_funds.invoice_id == non_sufficient_funds_object.get('invoice_id') assert non_sufficient_funds.description == non_sufficient_funds_object.get('description') + def test_find_all_non_sufficient_funds_invoices(session): """Test find_all_non_sufficient_funds_invoices.""" invoice_number = '10001' diff --git a/pay-api/tests/utilities/base_test.py b/pay-api/tests/utilities/base_test.py index e56611016..f258d9eed 100644 --- a/pay-api/tests/utilities/base_test.py +++ b/pay-api/tests/utilities/base_test.py @@ -25,7 +25,7 @@ from faker import Faker from pay_api.models import ( - CfsAccount, Comment, DistributionCode, EFTShortnames, Invoice, InvoiceReference, NonSufficientFundsModel, Payment, + CfsAccount, Comment, DistributionCode, EFTShortnames, Invoice, InvoiceReference, NonSufficientFundsModel, Payment, PaymentAccount, PaymentLineItem, PaymentTransaction, Receipt, RoutingSlip, Statement, StatementInvoices, StatementSettings) from pay_api.utils.constants import DT_SHORT_FORMAT