How to use the testfixtures.user.create_user function in testfixtures

To help you get started, we’ve selected a few testfixtures examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github byceps / byceps / tests / unit / services / shop / order / test_order_payment_state.py View on Github external
def create_order_with_payment_state(payment_state):
    user = create_user()

    shop_id = 'shop-123'
    placed_by = user

    order = create_order(shop_id, placed_by)
    order.payment_state = payment_state

    return order
github byceps / byceps / tests / integration / services / user_avatar / test_models_image_path.py View on Github external
def test_path(data_path, avatar_id, image_type, expected):
    user = create_user()

    avatar = create_avatar(user.id, avatar_id, image_type)

    with app_context() as app:
        app.config['PATH_DATA'] = data_path
        assert avatar.path == expected
github byceps / byceps / tests / unit / services / verification_token / test_models.py View on Github external
def test_is_expired(purpose, now, expected):
    user = create_user()
    created_at = datetime(2014, 11, 26, 17, 44, 53)

    token = create_verification_token(user.id, purpose, created_at)

    with freeze_time(now):
        assert token.is_expired == expected
github byceps / byceps / tests / unit / services / ticketing / test_models.py View on Github external
:License: Modified BSD, see LICENSE for details.
"""

from uuid import UUID

import pytest

from byceps.services.ticketing.models.ticket import Ticket

from testfixtures.user import create_user


ANY_BUNDLE_ID = UUID('4138fcfb-cc18-45c0-aede-d49a8e279885')


user1 = create_user('TicketUser1')
user2 = create_user('TicketUser2')
user3 = create_user('TicketUser3')


@pytest.mark.parametrize('bundle_id, expected', [
    (ANY_BUNDLE_ID, True ),
    (None,          False),
])
def test_belongs_to_bundle(bundle_id, expected):
    ticket = create_ticket(user1.id, bundle_id=bundle_id)

    assert ticket.belongs_to_bundle == expected


@pytest.mark.parametrize('owned_by_id, seat_managed_by_id, user_managed_by_id, user_id, expected', [
    (user1.id, None    , None    , user1.id, True ),
github byceps / byceps / tests / unit / services / user_avatar / test_models.py View on Github external
def test_hybrid_image_type_setter(image_type, expected):
    user = create_user()
    avatar = create_avatar(user.id)

    avatar.image_type = image_type

    assert avatar._image_type == expected
github byceps / byceps / tests / unit / services / ticketing / test_models.py View on Github external
from uuid import UUID

import pytest

from byceps.services.ticketing.models.ticket import Ticket

from testfixtures.user import create_user


ANY_BUNDLE_ID = UUID('4138fcfb-cc18-45c0-aede-d49a8e279885')


user1 = create_user('TicketUser1')
user2 = create_user('TicketUser2')
user3 = create_user('TicketUser3')


@pytest.mark.parametrize('bundle_id, expected', [
    (ANY_BUNDLE_ID, True ),
    (None,          False),
])
def test_belongs_to_bundle(bundle_id, expected):
    ticket = create_ticket(user1.id, bundle_id=bundle_id)

    assert ticket.belongs_to_bundle == expected


@pytest.mark.parametrize('owned_by_id, seat_managed_by_id, user_managed_by_id, user_id, expected', [
    (user1.id, None    , None    , user1.id, True ),
    (user1.id, user1.id, None    , user1.id, True ),
    (user1.id, None    , user1.id, user1.id, True ),
github byceps / byceps / tests / blueprints / user / test_models_avatar_image.py View on Github external
def test_hybrid_image_type_setter(image_type, expected):
    user = create_user(1)

    user.avatar_image_type = image_type

    assert user._avatar_image_type == expected
github byceps / byceps / tests / unit / services / user_avatar / test_models.py View on Github external
def test_hybrid_image_type_getter(database_value, expected):
    user = create_user()
    avatar = create_avatar(user.id)

    avatar._image_type = database_value

    assert avatar.image_type == expected