~homeworkprod/byceps

ref: a3214d27456b4060727966ca1ad520a92edaa6b2 byceps/testfixtures/shop_article.py -rw-r--r-- 842 bytes
a3214d27 — Jochen Kupperschmidt Make tourney avatar path depend on party path, but non-configurable besides that 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""
testfixtures.shop_article
~~~~~~~~~~~~~~~~~~~~~~~~~

:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""

from decimal import Decimal

from byceps.services.shop.article.models.article import Article


ANY_ARTICLE_ITEM_NUMBER = 'AEC-05-A00009'


def create_article(
    shop_id,
    *,
    item_number=ANY_ARTICLE_ITEM_NUMBER,
    description='Cool thing',
    price=None,
    tax_rate=None,
    available_from=None,
    available_until=None,
    quantity=1,
):
    if price is None:
        price = Decimal('24.95')

    if tax_rate is None:
        tax_rate = Decimal('0.19')

    return Article(
        shop_id,
        item_number,
        description,
        price,
        tax_rate,
        quantity,
        available_from=available_from,
        available_until=available_until,
    )