def get_account(account_number):
    account = commands.get_account(
        account_number=account_number,
        account_repository=current_app.account_repository)

    return jsonify(accountNumber=account.formatted_account_number,
                   accountStatus=account.account_status,
                   customerId=account.customer_id)
def test_get_account_when_account_is_found(account_repository):
    account = Account(customer_id='1234', account_status='active')
    account_repository.store(account)
    account_number = account.account_number

    returned_account = commands.get_account(
        account_number=account_number, account_repository=account_repository)

    assert account == returned_account
def test_get_account_when_account_is_not_found(account_repository):
    with pytest.raises(AccountNotFound):
        commands.get_account(account_number='12345678',
                             account_repository=account_repository)