~homeworkprod/byceps

af98802801b08d8ac9b65c6a31398191e54d994e — Jochen Kupperschmidt 1 year, 5 months ago fcc2cc1
Merge `admin_app_with_db` fixture into `admin_app`
M tests/api/conftest.py => tests/api/conftest.py +1 -1
@@ 20,7 20,7 @@ API_TOKEN = 'just-say-PLEASE!'


@pytest.fixture(scope='module')
def app(admin_app_with_db, data_path):
def app(admin_app, data_path):
    config_overrides = {
        'API_TOKEN': API_TOKEN,
        CONFIG_PATH_DATA_KEY: data_path,

M tests/blueprints/admin/newsletter/test_views.py => tests/blueprints/admin/newsletter/test_views.py +3 -3
@@ 118,7 118,7 @@ def newsletter_admin(_newsletter_admin):


@pytest.fixture(scope='module')
def newsletter_list(admin_app_with_db):
def newsletter_list(admin_app):
    newsletter_list = command_service.create_list('example', 'Example')
    yield newsletter_list
    command_service.delete_list(newsletter_list.id)


@@ 173,7 173,7 @@ def add_subscriptions(db, user_id, list_id, states):


@pytest.fixture(scope='module')
def client(admin_app_with_db, newsletter_admin):
def client(admin_app, newsletter_admin):
    """Provide a test HTTP client against the API."""
    with http_client(admin_app_with_db, user_id=newsletter_admin.id) as client:
    with http_client(admin_app, user_id=newsletter_admin.id) as client:
        yield client

M tests/blueprints/admin/shop/order/test_order_export.py => tests/blueprints/admin/shop/order/test_order_export.py +4 -4
@@ 150,13 150,13 @@ def order(shop, order_number_sequence, cart, orderer):


@freeze_time('2015-04-15 07:54:18')  # UTC
def test_serialize_existing_order(admin_app_with_db, shop, order, admin_user):
def test_serialize_existing_order(admin_app, shop, order, admin_user):
    filename = 'testfixtures/shop/order_export.xml'
    with codecs.open(filename, encoding='iso-8859-1') as f:
        expected = f.read().rstrip()

    url = f'/admin/shop/orders/{order.id}/export'
    with http_client(admin_app_with_db, user_id=admin_user.id) as client:
    with http_client(admin_app, user_id=admin_user.id) as client:
        response = client.get(url)

    assert response.status_code == 200


@@ 167,11 167,11 @@ def test_serialize_existing_order(admin_app_with_db, shop, order, admin_user):


@freeze_time('2015-04-15 07:54:18')  # UTC
def test_serialize_unknown_order(admin_app_with_db, shop, admin_user):
def test_serialize_unknown_order(admin_app, shop, admin_user):
    unknown_order_id = '00000000-0000-0000-0000-000000000000'

    url = f'/admin/shop/orders/{unknown_order_id}/export'
    with http_client(admin_app_with_db, user_id=admin_user.id) as client:
    with http_client(admin_app, user_id=admin_user.id) as client:
        response = client.get(url)

    assert response.status_code == 404

M tests/blueprints/admin/shop/order/test_views.py => tests/blueprints/admin/shop/order/test_views.py +9 -9
@@ 100,7 100,7 @@ def orderer():
def test_cancel_before_paid(
    order_email_service_mock,
    order_canceled_signal_send_mock,
    admin_app_with_db,
    admin_app,
    shop,
    article1,
    order_number_sequence,


@@ 122,7 122,7 @@ def test_cancel_before_paid(
        'reason': 'Dein Vorname ist albern!',
        'send_email': 'y',
    }
    with http_client(admin_app_with_db, user_id=admin.id) as client:
    with http_client(admin_app, user_id=admin.id) as client:
        response = client.post(url, data=form_data)

    order_afterwards = get_order(order_before.id)


@@ 153,7 153,7 @@ def test_cancel_before_paid(
def test_cancel_before_paid_without_sending_email(
    order_email_service_mock,
    order_canceled_signal_send_mock,
    admin_app_with_db,
    admin_app,
    shop,
    article2,
    order_number_sequence,


@@ 170,7 170,7 @@ def test_cancel_before_paid_without_sending_email(
        'reason': 'Dein Vorname ist albern!',
        # Sending e-mail is not requested.
    }
    with http_client(admin_app_with_db, user_id=admin.id) as client:
    with http_client(admin_app, user_id=admin.id) as client:
        response = client.post(url, data=form_data)

    order_afterwards = get_order(placed_order.id)


@@ 194,7 194,7 @@ def test_cancel_before_paid_without_sending_email(
def test_mark_order_as_paid(
    order_email_service_mock,
    order_paid_signal_send_mock,
    admin_app_with_db,
    admin_app,
    shop,
    order_number_sequence,
    admin,


@@ 207,7 207,7 @@ def test_mark_order_as_paid(

    url = f'/admin/shop/orders/{order_before.id}/mark_as_paid'
    form_data = {'payment_method': 'direct_debit'}
    with http_client(admin_app_with_db, user_id=admin.id) as client:
    with http_client(admin_app, user_id=admin.id) as client:
        response = client.post(url, data=form_data)

    order_afterwards = get_order(order_before.id)


@@ 240,7 240,7 @@ def test_cancel_after_paid(
    order_email_service_mock,
    order_paid_signal_send_mock,
    order_canceled_signal_send_mock,
    admin_app_with_db,
    admin_app,
    shop,
    article3,
    order_number_sequence,


@@ 259,7 259,7 @@ def test_cancel_after_paid(

    url = f'/admin/shop/orders/{order_before.id}/mark_as_paid'
    form_data = {'payment_method': 'bank_transfer'}
    with http_client(admin_app_with_db, user_id=admin.id) as client:
    with http_client(admin_app, user_id=admin.id) as client:
        response = client.post(url, data=form_data)

    url = f'/admin/shop/orders/{order_before.id}/cancel'


@@ 267,7 267,7 @@ def test_cancel_after_paid(
        'reason': 'Dein Vorname ist albern!',
        'send_email': 'n',
    }
    with http_client(admin_app_with_db, user_id=admin.id) as client:
    with http_client(admin_app, user_id=admin.id) as client:
        response = client.post(url, data=form_data)

    order_afterwards = get_order(order_before.id)

M tests/blueprints/metrics/test_metrics.py => tests/blueprints/metrics/test_metrics.py +1 -1
@@ 13,7 13,7 @@ def config_overrides():


@pytest.fixture
def client(admin_app_with_db, config_overrides, make_admin_app):
def client(admin_app, config_overrides, make_admin_app):
    app = make_admin_app(**config_overrides)
    with app.app_context():
        yield app.test_client()

M tests/conftest.py => tests/conftest.py +11 -15
@@ 57,27 57,23 @@ def make_admin_app(data_path):
    return _wrapper


@pytest.fixture(scope='session')
def admin_app(make_admin_app):
    """Provide the admin web application."""
    yield make_admin_app()


@pytest.fixture(scope='module')
def admin_app_with_db(admin_app, db):
    with admin_app.app_context():
def admin_app(make_admin_app, db):
    """Provide the admin web application."""
    app = make_admin_app()
    with app.app_context():
        with database_recreated(db):
            yield admin_app
            yield app


@pytest.fixture
def admin_client(admin_app_with_db):
def admin_client(admin_app):
    """Provide a test HTTP client against the admin web application."""
    return admin_app_with_db.test_client()
    return admin_app.test_client()


@pytest.fixture(scope='module')
def party_app(admin_app_with_db):
def party_app(admin_app):
    """Provide a party web application."""
    config_overrides = {CONFIG_PATH_DATA_KEY: data_path}
    app = create_party_app(config_overrides)


@@ 92,7 88,7 @@ def data_path():


@pytest.fixture(scope='module')
def make_user(admin_app_with_db):
def make_user(admin_app):
    def _wrapper(*args, **kwargs):
        user = create_user(*args, **kwargs)
        yield user


@@ 127,7 123,7 @@ def deleted_user(make_user):


@pytest.fixture(scope='module')
def make_email_config(admin_app_with_db):
def make_email_config(admin_app):
    def _wrapper(
        config_id: str = DEFAULT_EMAIL_CONFIG_ID,
        sender_address: str = 'info@shop.example',


@@ 160,7 156,7 @@ def site(email_config):


@pytest.fixture(scope='module')
def brand(admin_app_with_db):
def brand(admin_app):
    brand = create_brand()
    yield brand
    brand_service.delete_brand(brand.id)

M tests/services/authorization/test_deassign_all_roles_from_user.py => tests/services/authorization/test_deassign_all_roles_from_user.py +1 -1
@@ 16,7 16,7 @@ from byceps.services.authorization.service import (
from byceps.services.user import command_service as user_command_service


def test_deassign_all_roles_from_user(admin_app_with_db, user1, user2, roles):
def test_deassign_all_roles_from_user(admin_app, user1, user2, roles):
    assert find_role_ids_for_user(user1.id) == {'demigod', 'pausenclown'}
    assert find_role_ids_for_user(user2.id) == {'demigod', 'partymeister'}


M tests/services/authorization/test_permission_to_role_assignment.py => tests/services/authorization/test_permission_to_role_assignment.py +2 -2
@@ 8,7 8,7 @@ import pytest
from byceps.services.authorization import service


def test_assign_permission_to_role(admin_app_with_db, permission, role):
def test_assign_permission_to_role(admin_app, permission, role):
    role_permission_ids_before = get_permission_ids_for_role(role)
    assert permission.id not in role_permission_ids_before



@@ 18,7 18,7 @@ def test_assign_permission_to_role(admin_app_with_db, permission, role):
    assert permission.id in role_permission_ids_after


def test_deassign_permission_from_role(admin_app_with_db, permission, role):
def test_deassign_permission_from_role(admin_app, permission, role):
    service.assign_permission_to_role(permission.id, role.id)

    role_permission_ids_before = get_permission_ids_for_role(role)

M tests/services/authorization/test_role_to_user_assignment.py => tests/services/authorization/test_role_to_user_assignment.py +2 -2
@@ 11,7 11,7 @@ from byceps.services.authorization import service
PERMISSION_ID = 'tickle_mortals'


def test_assign_role_to_user(admin_app_with_db, user, admin_user, role):
def test_assign_role_to_user(admin_app, user, admin_user, role):
    user_permission_ids_before = service.get_permission_ids_for_user(user.id)
    assert PERMISSION_ID not in user_permission_ids_before



@@ 25,7 25,7 @@ def test_assign_role_to_user(admin_app_with_db, user, admin_user, role):
    service.assign_role_to_user(role.id, user.id, initiator_id=admin_user.id)


def test_deassign_role_from_user(admin_app_with_db, user, admin_user, role):
def test_deassign_role_from_user(admin_app, user, admin_user, role):
    service.assign_role_to_user(role.id, user.id, initiator_id=admin_user.id)

    user_permission_ids_before = service.get_permission_ids_for_user(user.id)

M tests/services/shop/order/actions/test_create_ticket_bundles.py => tests/services/shop/order/actions/test_create_ticket_bundles.py +1 -1
@@ 12,7 12,7 @@ from .base import get_tickets_for_order, mark_order_as_paid, place_order


def test_create_ticket_bundles(
    admin_app_with_db,
    admin_app,
    party,
    shop,
    order_number_sequence,

M tests/services/shop/order/actions/test_create_tickets.py => tests/services/shop/order/actions/test_create_tickets.py +1 -1
@@ 12,7 12,7 @@ from .base import get_tickets_for_order, mark_order_as_paid, place_order


def test_create_tickets(
    admin_app_with_db,
    admin_app,
    party,
    shop,
    order_number_sequence,

M tests/services/shop/order/test_ordered_articles_service.py => tests/services/shop/order/test_ordered_articles_service.py +1 -1
@@ 23,7 23,7 @@ def article(shop):
    article_service.delete_article(article.id)


def test_count_ordered_articles(admin_app_with_db, db, shop, article, orderer):
def test_count_ordered_articles(admin_app, db, shop, article, orderer):
    expected = {
        PaymentState.open: 12,
        PaymentState.canceled_before_paid: 7,

M tests/services/shop/order/test_service_mark_order_as_paid.py => tests/services/shop/order/test_service_mark_order_as_paid.py +1 -1
@@ 14,7 14,7 @@ from byceps.util.iterables import find


@pytest.fixture
def order(admin_app_with_db, shop, order_number_sequence, orderer, empty_cart):
def order(admin_app, shop, order_number_sequence, orderer, empty_cart):
    order, _ = order_service.place_order(shop.id, orderer, empty_cart)
    yield order
    order_service.delete_order(order.id)

M tests/services/shop/order/test_service_orders_placed_by_user.py => tests/services/shop/order/test_service_orders_placed_by_user.py +3 -5
@@ 39,18 39,16 @@ def shop2(email_config):


@pytest.fixture
def orderer1(admin_app_with_db):
def orderer1(admin_app):
    return create_orderer('Orderer1')


@pytest.fixture
def orderer2(admin_app_with_db):
def orderer2(admin_app):
    return create_orderer('Orderer2')


def test_get_orders_placed_by_user(
    admin_app_with_db, shop1, shop2, orderer1, orderer2
):
def test_get_orders_placed_by_user(admin_app, shop1, shop2, orderer1, orderer2):
    order1 = place_order(shop1.id, orderer1)
    order2 = place_order(shop1.id, orderer2)  # different user
    order3 = place_order(shop1.id, orderer1)

M tests/services/shop/sequence/test_service_sequence_number_generation.py => tests/services/shop/sequence/test_service_sequence_number_generation.py +4 -4
@@ 28,7 28,7 @@ def shop2(email_config):
    shop_service.delete_shop(shop.id)


def test_generate_article_number_default(admin_app_with_db, shop1):
def test_generate_article_number_default(admin_app, shop1):
    shop = shop1

    sequence_service.create_article_number_sequence(shop.id, 'AEC-01-A')


@@ 41,7 41,7 @@ def test_generate_article_number_default(admin_app_with_db, shop1):
    sequence_service.delete_order_number_sequence(shop.id)


def test_generate_article_number_custom(admin_app_with_db, shop2):
def test_generate_article_number_custom(admin_app, shop2):
    shop = shop2

    sequence_service.create_article_number_sequence(


@@ 56,7 56,7 @@ def test_generate_article_number_custom(admin_app_with_db, shop2):
    sequence_service.delete_order_number_sequence(shop.id)


def test_generate_order_number_default(admin_app_with_db, shop1):
def test_generate_order_number_default(admin_app, shop1):
    shop = shop1

    sequence_service.create_order_number_sequence(shop.id, 'AEC-01-B')


@@ 69,7 69,7 @@ def test_generate_order_number_default(admin_app_with_db, shop1):
    sequence_service.delete_order_number_sequence(shop.id)


def test_generate_order_number_custom(admin_app_with_db, shop2):
def test_generate_order_number_custom(admin_app, shop2):
    shop = shop2

    last_assigned_order_sequence_number = 206

M tests/services/ticketing/test_bundle_revocation.py => tests/services/ticketing/test_bundle_revocation.py +1 -1
@@ 12,7 12,7 @@ from byceps.services.ticketing import (
)


def test_revoke_bundle(admin_app_with_db, bundle, ticketing_admin):
def test_revoke_bundle(admin_app, bundle, ticketing_admin):
    expected_quantity = 4

    tickets_before = bundle_service.find_tickets_for_bundle(bundle.id)

M tests/services/ticketing/test_revocation.py => tests/services/ticketing/test_revocation.py +4 -4
@@ 70,7 70,7 @@ def seats(tickets, area):
        seat_service.delete_seat(seat.id)


def test_revoke_ticket(admin_app_with_db, ticket, ticketing_admin):
def test_revoke_ticket(admin_app, ticket, ticketing_admin):
    ticket_before = ticket
    assert not ticket_before.revoked



@@ 98,7 98,7 @@ def test_revoke_ticket(admin_app_with_db, ticket, ticketing_admin):
    }


def test_revoke_tickets(admin_app_with_db, tickets, ticketing_admin):
def test_revoke_tickets(admin_app, tickets, ticketing_admin):
    tickets_before = tickets

    for ticket_before in tickets_before:


@@ 130,7 130,7 @@ def test_revoke_tickets(admin_app_with_db, tickets, ticketing_admin):


def test_revoke_ticket_with_seat(
    admin_app_with_db, area, ticket, ticketing_admin, seat
    admin_app, area, ticket, ticketing_admin, seat
):
    ticket_seat_management_service.occupy_seat(
        ticket.id, seat.id, ticket.owned_by_id


@@ 156,7 156,7 @@ def test_revoke_ticket_with_seat(


def test_revoke_tickets_with_seats(
    admin_app_with_db, area, tickets, ticketing_admin, seats
    admin_app, area, tickets, ticketing_admin, seats
):
    ticket_ids = {ticket.id for ticket in tickets}


M tests/services/ticketing/test_seat_management_service.py => tests/services/ticketing/test_seat_management_service.py +6 -8
@@ 53,7 53,7 @@ def seat_of_another_category(area, another_category):


@pytest.fixture
def ticket(admin_app_with_db, category, ticket_owner):
def ticket(admin_app, category, ticket_owner):
    ticket = ticket_creation_service.create_ticket(category.id, ticket_owner.id)
    yield ticket
    ticket_service.delete_ticket(ticket.id)


@@ 69,9 69,7 @@ def ticket_bundle(category, ticket_owner):
    ticket_bundle_service.delete_bundle(bundle.id)


def test_appoint_and_withdraw_seat_manager(
    admin_app_with_db, ticket, ticket_manager
):
def test_appoint_and_withdraw_seat_manager(admin_app, ticket, ticket_manager):
    assert ticket.seat_managed_by_id is None

    # appoint seat manager


@@ 112,7 110,7 @@ def test_appoint_and_withdraw_seat_manager(
    )


def test_occupy_and_release_seat(admin_app_with_db, seat1, seat2, ticket):
def test_occupy_and_release_seat(admin_app, seat1, seat2, ticket):
    assert ticket.occupied_seat_id is None

    # occupy seat


@@ 169,7 167,7 @@ def test_occupy_and_release_seat(admin_app_with_db, seat1, seat2, ticket):
    )


def test_occupy_seat_with_invalid_id(admin_app_with_db, ticket):
def test_occupy_seat_with_invalid_id(admin_app, ticket):
    invalid_seat_id = 'ffffffff-ffff-ffff-ffff-ffffffffffff'

    with raises(ValueError):


@@ 179,7 177,7 @@ def test_occupy_seat_with_invalid_id(admin_app_with_db, ticket):


def test_occupy_seat_with_bundled_ticket(
    admin_app_with_db, ticket_bundle, seat1, ticket
    admin_app, ticket_bundle, seat1, ticket
):
    bundled_ticket = ticket_bundle.tickets[0]



@@ 190,7 188,7 @@ def test_occupy_seat_with_bundled_ticket(


def test_occupy_seat_with_wrong_category(
    admin_app_with_db, another_category, seat_of_another_category, ticket
    admin_app, another_category, seat_of_another_category, ticket
):
    assert ticket.category_id != another_category.id


M tests/services/ticketing/test_user_check_in.py => tests/services/ticketing/test_user_check_in.py +6 -8
@@ 21,15 21,13 @@ from byceps.services.ticketing.exceptions import (


@pytest.fixture
def ticket(admin_app_with_db, category, ticket_owner):
def ticket(admin_app, category, ticket_owner):
    ticket = ticket_creation_service.create_ticket(category.id, ticket_owner.id)
    yield ticket
    ticket_service.delete_ticket(ticket.id)


def test_check_in_user(
    admin_app_with_db, db, ticket, ticketing_admin, ticket_user
):
def test_check_in_user(admin_app, db, ticket, ticketing_admin, ticket_user):
    ticket_before = ticket

    ticket_before.used_by_id = ticket_user.id


@@ 63,14 61,14 @@ def test_check_in_user(


def test_check_in_user_with_ticket_without_assigned_user(
    admin_app_with_db, ticket, ticketing_admin
    admin_app, ticket, ticketing_admin
):
    with raises(TicketLacksUser):
        check_in_user(ticket.id, ticketing_admin.id)


def test_check_in_user_with_revoked_ticket(
    admin_app_with_db, db, ticket, ticketing_admin, ticket_user
    admin_app, db, ticket, ticketing_admin, ticket_user
):
    ticket.revoked = True
    ticket.used_by_id = ticket_user.id


@@ 81,7 79,7 @@ def test_check_in_user_with_revoked_ticket(


def test_check_in_user_with_ticket_user_already_checked_in(
    admin_app_with_db, db, ticket, ticketing_admin, ticket_user
    admin_app, db, ticket, ticketing_admin, ticket_user
):
    ticket.used_by_id = ticket_user.id
    ticket.user_checked_in = True


@@ 92,7 90,7 @@ def test_check_in_user_with_ticket_user_already_checked_in(


def test_check_in_suspended_user(
    admin_app_with_db, db, ticket, ticketing_admin, ticket_user
    admin_app, db, ticket, ticketing_admin, ticket_user
):
    ticket.used_by_id = ticket_user.id
    ticket_user.suspended = True

M tests/services/ticketing/test_user_management_service.py => tests/services/ticketing/test_user_management_service.py +3 -5
@@ 14,15 14,13 @@ from byceps.services.ticketing import (


@pytest.fixture
def ticket(admin_app_with_db, category, ticket_owner):
def ticket(admin_app, category, ticket_owner):
    ticket = ticket_creation_service.create_ticket(category.id, ticket_owner.id)
    yield ticket
    ticket_service.delete_ticket(ticket.id)


def test_appoint_and_withdraw_user_manager(
    admin_app_with_db, ticket, ticket_manager
):
def test_appoint_and_withdraw_user_manager(admin_app, ticket, ticket_manager):
    assert ticket.user_managed_by_id is None

    # appoint user manager


@@ 63,7 61,7 @@ def test_appoint_and_withdraw_user_manager(
    )


def test_appoint_and_withdraw_user(admin_app_with_db, ticket, ticket_user):
def test_appoint_and_withdraw_user(admin_app, ticket, ticket_user):
    assert ticket.used_by_id is None

    # appoint user

M tests/services/user/test_change_email_address.py => tests/services/user/test_change_email_address.py +2 -2
@@ 10,7 10,7 @@ from byceps.services.user import event_service
from tests.helpers import create_user


def test_change_email_address_with_reason(admin_app_with_db, admin_user):
def test_change_email_address_with_reason(admin_app, admin_user):
    old_email_address = 'zero-cool@example.com'
    new_email_address = 'crash.override@example.com'
    reason = 'Does not want to be recognized by Acid Burn.'


@@ 57,7 57,7 @@ def test_change_email_address_with_reason(admin_app_with_db, admin_user):
    }


def test_change_email_address_without_reason(admin_app_with_db, admin_user):
def test_change_email_address_without_reason(admin_app, admin_user):
    old_email_address = 'address_with_tyop@example.com'
    new_email_address = 'address_without_typo@example.com'


M tests/services/user/test_change_screen_name.py => tests/services/user/test_change_screen_name.py +2 -2
@@ 10,7 10,7 @@ from byceps.services.user import event_service
from tests.helpers import create_user


def test_change_screen_name_with_reason(admin_app_with_db, admin_user):
def test_change_screen_name_with_reason(admin_app, admin_user):
    old_screen_name = 'Zero_Cool'
    new_screen_name = 'Crash_Override'
    reason = 'Do not reveal to Acid Burn.'


@@ 53,7 53,7 @@ def test_change_screen_name_with_reason(admin_app_with_db, admin_user):
    }


def test_change_screen_name_without_reason(admin_app_with_db, admin_user):
def test_change_screen_name_without_reason(admin_app, admin_user):
    old_screen_name = 'NameWithTyop'
    new_screen_name = 'NameWithoutTypo'


M tests/services/user/test_delete_account.py => tests/services/user/test_delete_account.py +1 -1
@@ 35,7 35,7 @@ def role(permission):
    authorization_service.delete_role(role.id)


def test_delete_account(admin_app_with_db, db, permission, role, admin_user):
def test_delete_account(admin_app, db, permission, role, admin_user):
    user_id = UUID('20868b15-b935-40fc-8054-38854ef8509a')
    screen_name = 'GetRidOfMe'
    email_address = 'timedout@example.net'

M tests/services/user/test_detail_extras.py => tests/services/user/test_detail_extras.py +3 -3
@@ 10,7 10,7 @@ from byceps.services.user.models.detail import UserDetail
from tests.helpers import create_user_with_detail


def test_set_and_remove(admin_app_with_db):
def test_set_and_remove(admin_app):
    user_id = create_user_with_detail('set-and-remove').id

    # Make sure field is `NULL`.


@@ 33,7 33,7 @@ def test_set_and_remove(admin_app_with_db):
    assert get_extras(user_id) == {}


def test_remove_unknown_key_from_null_extras(admin_app_with_db):
def test_remove_unknown_key_from_null_extras(admin_app):
    user_id = create_user_with_detail('null-extras').id

    assert get_extras(user_id) is None


@@ 42,7 42,7 @@ def test_remove_unknown_key_from_null_extras(admin_app_with_db):
    assert get_extras(user_id) is None


def test_remove_unknown_key_from_empty_extras(admin_app_with_db):
def test_remove_unknown_key_from_empty_extras(admin_app):
    user_id = create_user_with_detail('empty-extras').id

    set_extras_to_empty_dict(user_id)

M tests/services/user/test_initialize.py => tests/services/user/test_initialize.py +4 -4
@@ 28,7 28,7 @@ def already_initialized_user(make_user):

@pytest.fixture
def role(
    admin_app_with_db,
    admin_app,
    uninitialized_user_created_online,
    uninitialized_user_created_at_party_checkin_by_admin,
    already_initialized_user,


@@ 48,7 48,7 @@ def role(


def test_initialize_account_as_user(
    admin_app_with_db, role, uninitialized_user_created_online
    admin_app, role, uninitialized_user_created_online
):
    user = uninitialized_user_created_online



@@ 88,7 88,7 @@ def test_initialize_account_as_user(


def test_initialize_account_as_admin(
    admin_app_with_db,
    admin_app,
    role,
    uninitialized_user_created_at_party_checkin_by_admin,
    admin_user,


@@ 134,7 134,7 @@ def test_initialize_account_as_admin(


def test_initialize_already_initialized_account(
    admin_app_with_db, role, already_initialized_user, admin_user
    admin_app, role, already_initialized_user, admin_user
):
    user = already_initialized_user


M tests/services/user/test_query.py => tests/services/user/test_query.py +5 -5
@@ 12,7 12,7 @@ from byceps.services.user import service as user_service
from tests.helpers import create_user


def test_find_user_by_screen_name_found(admin_app_with_db):
def test_find_user_by_screen_name_found(admin_app):
    screen_name = 'ghost'

    user = create_user(screen_name)


@@ 22,13 22,13 @@ def test_find_user_by_screen_name_found(admin_app_with_db):
    assert actual.id == user.id


def test_find_user_by_screen_name_not_found(admin_app_with_db):
def test_find_user_by_screen_name_not_found(admin_app):
    actual = user_service.find_user_by_screen_name('unknown_dude')

    assert actual is None


def test_get_anonymous_user(admin_app_with_db):
def test_get_anonymous_user(admin_app):
    user = user_service.get_anonymous_user()

    assert user.id == UUID('00000000-0000-0000-0000-000000000000')


@@ 41,7 41,7 @@ def test_get_anonymous_user(admin_app_with_db):
    assert not user.is_orga


def test_get_email_address_found(admin_app_with_db):
def test_get_email_address_found(admin_app):
    email_address = 'lanparty@lar.ge'

    user = create_user('xpandr', email_address=email_address)


@@ 51,7 51,7 @@ def test_get_email_address_found(admin_app_with_db):
    assert actual == email_address


def test_get_email_address_not_found(admin_app_with_db):
def test_get_email_address_not_found(admin_app):
    unknown_user_id = UUID('00000000-0000-0000-0000-000000000001')

    with raises(ValueError):

M tests/services/user/test_suspend_unsuspend.py => tests/services/user/test_suspend_unsuspend.py +2 -2
@@ 20,7 20,7 @@ def remorseful_user(make_user):
    yield from make_user('TemporaryNuisance')


def test_suspend(admin_app_with_db, cheater, admin_user):
def test_suspend(admin_app, cheater, admin_user):
    user_id = cheater.id

    reason = 'User has been caught cheating.'


@@ 51,7 51,7 @@ def test_suspend(admin_app_with_db, cheater, admin_user):
    }


def test_unsuspend(admin_app_with_db, remorseful_user, admin_user):
def test_unsuspend(admin_app, remorseful_user, admin_user):
    user_id = remorseful_user.id

    user_command_service.suspend_account(user_id, admin_user.id, 'Annoying')