def test_find_all_by_account_id(session): """Assert that the financing statement summary list by account id first item contains all expected elements.""" statement_list = FinancingStatement.find_all_by_account_id('PS12345', True) assert statement_list assert statement_list[0]['matchType'] assert statement_list[0]['baseRegistrationNumber'] assert statement_list[0]['registrationType'] assert statement_list[0]['createDateTime']
def test_find_all_by_account_id(session): """Assert that the financing statement summary list by account id first item contains all expected elements.""" statement_list = FinancingStatement.find_all_by_account_id('PS12345') assert statement_list assert statement_list[0]['registrationNumber'] assert statement_list[0]['registrationType'] assert statement_list[0]['registrationClass'] assert statement_list[0]['registrationDescription'] assert statement_list[0]['statusType'] assert statement_list[0]['createDateTime'] assert statement_list[0]['lastUpdateDateTime'] assert statement_list[0]['expireDays'] assert statement_list[0]['registeringParty'] assert statement_list[0]['securedParties'] # assert statement_list[0]['clientReferenceId'] assert statement_list[0]['path']
def get(): """Get the list of financing statements created by the header account ID.""" try: # Quick check: must provide an account ID. account_id = get_account_id(request) if account_id is None: return account_required_response() # Verify request JWT and account ID if not authorized(account_id, jwt): return unauthorized_error_response(account_id) # Try to fetch financing statement list for account ID statement_list = FinancingStatement.find_all_by_account_id(account_id, is_staff(jwt)) return jsonify(statement_list), HTTPStatus.OK except BusinessException as exception: return business_exception_response(exception) except Exception as default_exception: # noqa: B902; return nicer default error return default_exception_response(default_exception)
def test_find_all_by_account_id_no_result(session): """Assert that the financing statement summary list by invalid account id works as expected.""" statement_list = FinancingStatement.find_all_by_account_id('XXXXX45', True) assert len(statement_list) == 0