Conditions | 2 |
Total Lines | 101 |
Code Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | """ |
||
15 | @pytest.mark.parametrize( |
||
16 | 'locale, expected', |
||
17 | [ |
||
18 | ( |
||
19 | 'de', |
||
20 | '''\ |
||
21 | From: NameAndAddress(name=None, address='[email protected]') |
||
22 | To: ['[email protected]'] |
||
23 | Subject: Deine Bestellung (AWSM-ORDR-9247) ist eingegangen. |
||
24 | |||
25 | |||
26 | Hallo Orderer, |
||
27 | |||
28 | vielen Dank für deine Bestellung mit der Nummer AWSM-ORDR-9247 am 12.10.2021 über unsere Website. |
||
29 | |||
30 | Folgende Artikel hast du bestellt: |
||
31 | |||
32 | Gesamtbetrag: 42,95 € |
||
33 | |||
34 | Bitte überweise den Gesamtbetrag auf folgendes Konto: |
||
35 | |||
36 | Zahlungsempfänger: <Name> |
||
37 | IBAN: <IBAN> |
||
38 | BIC: <BIC> |
||
39 | Bank: <Kreditinstitut> |
||
40 | Verwendungszweck: AWSM-ORDR-9247 |
||
41 | |||
42 | Wir werden dich informieren, sobald wir deine Zahlung erhalten haben. |
||
43 | |||
44 | Hier kannst du deine Bestellungen einsehen: https://www.acmecon.test/shop/orders |
||
45 | |||
46 | Für Fragen stehen wir gerne zur Verfügung. |
||
47 | |||
48 | Viele Grüße, |
||
49 | das Team der Acme Entertainment Convention |
||
50 | |||
51 | -- |
||
52 | Acme Entertainment Convention |
||
53 | |||
54 | E-Mail: [email protected] |
||
55 | ''', |
||
56 | ), |
||
57 | ( |
||
58 | 'en', |
||
59 | '''\ |
||
60 | From: NameAndAddress(name=None, address='[email protected]') |
||
61 | To: ['[email protected]'] |
||
62 | Subject: Your order (AWSM-ORDR-9247) has been received. |
||
63 | |||
64 | |||
65 | Hello Orderer, |
||
66 | |||
67 | thank you for your order AWSM-ORDR-9247 on 12.10.2021 through our website. |
||
68 | |||
69 | You have ordered these items: |
||
70 | |||
71 | Total amount: 42,95 € |
||
72 | |||
73 | Bitte überweise den Gesamtbetrag auf folgendes Konto: |
||
74 | |||
75 | Zahlungsempfänger: <Name> |
||
76 | IBAN: <IBAN> |
||
77 | BIC: <BIC> |
||
78 | Bank: <Kreditinstitut> |
||
79 | Verwendungszweck: AWSM-ORDR-9247 |
||
80 | |||
81 | Wir werden dich informieren, sobald wir deine Zahlung erhalten haben. |
||
82 | |||
83 | Hier kannst du deine Bestellungen einsehen: https://www.acmecon.test/shop/orders |
||
84 | |||
85 | Für Fragen stehen wir gerne zur Verfügung. |
||
86 | |||
87 | Viele Grüße, |
||
88 | das Team der Acme Entertainment Convention |
||
89 | |||
90 | -- |
||
91 | Acme Entertainment Convention |
||
92 | |||
93 | E-Mail: [email protected] |
||
94 | ''', |
||
95 | ), |
||
96 | ], |
||
97 | ) |
||
98 | def test_example_placed_order_message_text( |
||
99 | admin_app, |
||
100 | order_admin, |
||
101 | shop, |
||
102 | email_payment_instructions_snippet_id, |
||
103 | email_footer_snippet_id, |
||
104 | locale, |
||
105 | expected, |
||
106 | ): |
||
107 | app = admin_app |
||
108 | current_user = get_current_user_for_user(order_admin) |
||
109 | |||
110 | with current_user_set(app, current_user), app.app_context(): |
||
111 | actual = example_service.build_example_placed_order_message_text( |
||
112 | shop.id, locale |
||
113 | ) |
||
114 | |||
115 | assert actual == expected |
||
116 | |||
266 |