示例#1
0
def test_find_all_by_account_id(session):
    """Assert that the draft summary list first item contains all expected elements."""
    draft_list = Draft.find_all_by_account_id('PS12345')
    assert draft_list[0]['type']
    assert draft_list[0]['documentId']
    assert draft_list[0]['registrationType']
    assert draft_list[0]['path']
    assert draft_list[0]['createDateTime']
示例#2
0
def test_find_all_by_account_id(session):
    """Assert that the draft summary list items contains all expected elements."""
    draft_list = Draft.find_all_by_account_id('PS12345')
    # print(draft_list)
    assert draft_list
    for draft in draft_list:
        assert draft['type']
        assert draft['documentId']
        assert draft['registrationType']
        assert draft['registrationDescription']
        assert draft['createDateTime']
        assert draft['lastUpdateDateTime']
        # assert draft['clientReferenceId']
        assert draft['path']
        assert draft['registeringName']
        if draft['type'] != 'FINANCING_STATEMENT':
            assert draft['baseRegistrationNumber']
        assert draft['documentId'] != 'D-T-0001'
示例#3
0
    def get():
        """Get the list of draft statements belonging to 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 draft list for account ID
            draft_list = Draft.find_all_by_account_id(account_id)

            return jsonify(draft_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)
示例#4
0
def test_find_by_account_id_no_result(session):
    """Assert that the find draft statement by invalid account ID returns the expected result."""
    drafts = Draft.find_all_by_account_id('X12345X')

    # check
    assert len(drafts) == 0