@@ -13,10 +13,36 @@ def test_gen_paypal_rule_empty(self):
13
13
self .assertEqual (expected , actual ) # add assertion here
14
14
self .assertEqual (None , account ) # add assertion here
15
15
16
+ def test_gen_paypal_rule_if_format (self ):
17
+ config = {
18
+ 'paypal' : {
19
+ 'if_format' : [
20
+ '{ref}.*PP.[0-9]+.PP.*{name}.*, Ihr Einkauf bei.*PayPal' ,
21
+ '{ref}.*PP.[0-9]+.PP.*{name}.*, Ihr Einkauf bei.*PAYPAL'
22
+ ],
23
+ 'payee' : 'PayPal Europe S.a.r.l. et Cie S.C.A' ,
24
+ },
25
+ }
26
+ rule = {
27
+ 'name' : 'Steam' ,
28
+ 'account' : 'Expenses:Hobbies:Gaming:Steam' ,
29
+ }
30
+ expected = """
31
+ if .*.*PP.[0-9]+.PP.*Steam.*, Ihr Einkauf bei.*PayPal
32
+ .*.*PP.[0-9]+.PP.*Steam.*, Ihr Einkauf bei.*PAYPAL
33
+ description PayPal Europe S.a.r.l. et Cie S.C.A | PayPal Steam
34
+ comment type:%buchungstext, payee:PayPal Europe S.a.r.l. et Cie S.C.A, name:Steam
35
+ account1 Expenses:Hobbies:Gaming:Steam
36
+
37
+ """
38
+ actual , account = gen_paypal_rule (config , rule )
39
+ self .assertEqual (expected , actual ) # add assertion here
40
+ self .assertEqual ('Expenses:Hobbies:Gaming:Steam' , account ) # add assertion here
41
+
16
42
def test_gen_paypal_rule_name (self ):
17
43
config = {
18
44
'paypal' : {
19
- 'prefix' : 'PP.6330.P ' ,
45
+ 'prefix' : 'PP.[0-9]+.PP ' ,
20
46
'suffix' : 'PayPal' ,
21
47
'payee' : 'PayPal Europe S.a.r.l. et Cie S.C.A' ,
22
48
},
@@ -26,7 +52,7 @@ def test_gen_paypal_rule_name(self):
26
52
'account' : 'Expenses:Hobbies:Gaming:Steam' ,
27
53
}
28
54
expected = """
29
- if PP.1234 .PP.*Steam.*.*.*PayPal
55
+ if PP.[0-9]+ .PP.*Steam.*.*.*PayPal
30
56
Steam.*.*.*PayPal
31
57
Steam.*PAYPAL.*.*
32
58
description PayPal Europe S.a.r.l. et Cie S.C.A | PayPal Steam
@@ -41,7 +67,7 @@ def test_gen_paypal_rule_name(self):
41
67
def test_gen_paypal_rule_description (self ):
42
68
config = {
43
69
'paypal' : {
44
- 'prefix' : 'PP.6330.P ' ,
70
+ 'prefix' : 'PP.[0-9]+.PP ' ,
45
71
'suffix' : 'PayPal' ,
46
72
'payee' : 'PayPal Europe S.a.r.l. et Cie S.C.A' ,
47
73
},
@@ -52,7 +78,7 @@ def test_gen_paypal_rule_description(self):
52
78
'description' : 'Steam'
53
79
}
54
80
expected = """
55
- if PP.1234 .PP.*steampowered.*.*.*PayPal
81
+ if PP.[0-9]+ .PP.*steampowered.*.*.*PayPal
56
82
steampowered.*.*.*PayPal
57
83
steampowered.*PAYPAL.*.*
58
84
description PayPal Europe S.a.r.l. et Cie S.C.A | PayPal Steam
@@ -67,7 +93,7 @@ def test_gen_paypal_rule_description(self):
67
93
def test_gen_paypal_rule_full_description (self ):
68
94
config = {
69
95
'paypal' : {
70
- 'prefix' : 'PP.6330.P ' ,
96
+ 'prefix' : 'PP.[0-9]+.PP ' ,
71
97
'suffix' : 'PayPal' ,
72
98
'payee' : 'PayPal Europe S.a.r.l. et Cie S.C.A' ,
73
99
},
@@ -78,7 +104,7 @@ def test_gen_paypal_rule_full_description(self):
78
104
'full_description' : 'Google | Play Store'
79
105
}
80
106
expected = """
81
- if PP.1234 .PP.*Google.*.*.*PayPal
107
+ if PP.[0-9]+ .PP.*Google.*.*.*PayPal
82
108
Google.*.*.*PayPal
83
109
Google.*PAYPAL.*.*
84
110
description Google | Play Store
@@ -93,7 +119,7 @@ def test_gen_paypal_rule_full_description(self):
93
119
def test_gen_paypal_rule_payee (self ):
94
120
config = {
95
121
'paypal' : {
96
- 'prefix' : 'PP.6330.P ' ,
122
+ 'prefix' : 'PP.[0-9]+.PP ' ,
97
123
'suffix' : 'PayPal' ,
98
124
'payee' : 'PayPal Europe S.a.r.l. et Cie S.C.A' ,
99
125
},
@@ -105,7 +131,7 @@ def test_gen_paypal_rule_payee(self):
105
131
'payee' : 'PayPal Europe S.a.r.l., et Cie S.C.A'
106
132
}
107
133
expected = """
108
- if PP.1234 .PP.*steampowered.*.*.*PayPal
134
+ if PP.[0-9]+ .PP.*steampowered.*.*.*PayPal
109
135
steampowered.*.*.*PayPal
110
136
steampowered.*PAYPAL.*.*
111
137
description PayPal Europe S.a.r.l., et Cie S.C.A | PayPal Steam
@@ -120,7 +146,7 @@ def test_gen_paypal_rule_payee(self):
120
146
def test_gen_paypal_rule_no_payee (self ):
121
147
config = {
122
148
'paypal' : {
123
- 'prefix' : 'PP.6330.P ' ,
149
+ 'prefix' : 'PP.[0-9]+.PP ' ,
124
150
'suffix' : 'PayPal' ,
125
151
},
126
152
}
@@ -130,7 +156,7 @@ def test_gen_paypal_rule_no_payee(self):
130
156
'description' : 'Steam' ,
131
157
}
132
158
expected = """
133
- if PP.1234 .PP.*steampowered.*.*.*PayPal
159
+ if PP.[0-9]+ .PP.*steampowered.*.*.*PayPal
134
160
steampowered.*.*.*PayPal
135
161
steampowered.*PAYPAL.*.*
136
162
description %payee | PayPal Steam
@@ -145,7 +171,7 @@ def test_gen_paypal_rule_no_payee(self):
145
171
def test_gen_paypal_rule_amount (self ):
146
172
config = {
147
173
'paypal' : {
148
- 'prefix' : 'PP.6330.P ' ,
174
+ 'prefix' : 'PP.[0-9]+.PP ' ,
149
175
'suffix' : 'PayPal' ,
150
176
'payee' : 'PayPal Europe S.a.r.l. et Cie S.C.A' ,
151
177
},
@@ -158,8 +184,8 @@ def test_gen_paypal_rule_amount(self):
158
184
'amount' : - 19.99 ,
159
185
}
160
186
expected = """
161
- if PP.1234 .PP.*steampowered.*.*.*PayPal.*, -19,99
162
- PP.1234 .PP.*steampowered.*.*.*PayPal.*,-19,99
187
+ if PP.[0-9]+ .PP.*steampowered.*.*.*PayPal.*, -19,99
188
+ PP.[0-9]+ .PP.*steampowered.*.*.*PayPal.*,-19,99
163
189
steampowered.*.*.*PayPal.*, -19,99
164
190
steampowered.*.*.*PayPal.*,-19,99
165
191
steampowered.*PAYPAL.*.*.*, -19,99
@@ -176,7 +202,7 @@ def test_gen_paypal_rule_amount(self):
176
202
def test_gen_paypal_rule_currency (self ):
177
203
config = {
178
204
'paypal' : {
179
- 'prefix' : 'PP.6330.P ' ,
205
+ 'prefix' : 'PP.[0-9]+.PP ' ,
180
206
'suffix' : 'PayPal' ,
181
207
'payee' : 'PayPal Europe S.a.r.l. et Cie S.C.A' ,
182
208
},
@@ -190,8 +216,8 @@ def test_gen_paypal_rule_currency(self):
190
216
'currency' : 'EUR'
191
217
}
192
218
expected = """
193
- if PP.1234 .PP.*steampowered.*.*.*PayPal.*, -19,99,EUR
194
- PP.1234 .PP.*steampowered.*.*.*PayPal.*,-19,99,EUR
219
+ if PP.[0-9]+ .PP.*steampowered.*.*.*PayPal.*, -19,99,EUR
220
+ PP.[0-9]+ .PP.*steampowered.*.*.*PayPal.*,-19,99,EUR
195
221
steampowered.*.*.*PayPal.*, -19,99,EUR
196
222
steampowered.*.*.*PayPal.*,-19,99,EUR
197
223
steampowered.*PAYPAL.*.*.*, -19,99,EUR
@@ -208,7 +234,7 @@ def test_gen_paypal_rule_currency(self):
208
234
def test_gen_paypal_rule_big_amount (self ):
209
235
config = {
210
236
'paypal' : {
211
- 'prefix' : 'PP.6330.P ' ,
237
+ 'prefix' : 'PP.[0-9]+.PP ' ,
212
238
'suffix' : 'PayPal' ,
213
239
'payee' : 'PayPal Europe S.a.r.l. et Cie S.C.A' ,
214
240
},
@@ -221,7 +247,7 @@ def test_gen_paypal_rule_big_amount(self):
221
247
'amount' : - 649.0 ,
222
248
}
223
249
expected = """
224
- if PP.1234 .PP.*MMS E-Commerce GmbH.*.*.*PayPal.*,-649
250
+ if PP.[0-9]+ .PP.*MMS E-Commerce GmbH.*.*.*PayPal.*,-649
225
251
MMS E-Commerce GmbH.*.*.*PayPal.*,-649
226
252
MMS E-Commerce GmbH.*PAYPAL.*.*.*,-649
227
253
description PayPal Europe S.a.r.l. et Cie S.C.A | PayPal Saturn
0 commit comments