sqlite-export-for-ynab 2.9.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sqlite_export_for_ynab/__init__.py +6 -0
- sqlite_export_for_ynab/__main__.py +6 -0
- sqlite_export_for_ynab/_main.py +687 -0
- sqlite_export_for_ynab/ddl/__init__.py +0 -0
- sqlite_export_for_ynab/ddl/create-relations.sql +334 -0
- sqlite_export_for_ynab/ddl/drop-relations.sql +23 -0
- sqlite_export_for_ynab/py.typed +0 -0
- sqlite_export_for_ynab-2.9.1.dist-info/METADATA +594 -0
- sqlite_export_for_ynab-2.9.1.dist-info/RECORD +17 -0
- sqlite_export_for_ynab-2.9.1.dist-info/WHEEL +5 -0
- sqlite_export_for_ynab-2.9.1.dist-info/entry_points.txt +2 -0
- sqlite_export_for_ynab-2.9.1.dist-info/licenses/LICENSE +21 -0
- sqlite_export_for_ynab-2.9.1.dist-info/top_level.txt +3 -0
- testing/__init__.py +0 -0
- testing/fixtures.py +626 -0
- tests/__init__.py +0 -0
- tests/_main_test.py +1125 -0
testing/fixtures.py
ADDED
|
@@ -0,0 +1,626 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from datetime import date
|
|
4
|
+
from uuid import UUID
|
|
5
|
+
from uuid import uuid4
|
|
6
|
+
|
|
7
|
+
from asyncio_for_ynab import Account
|
|
8
|
+
from asyncio_for_ynab import AccountsResponse
|
|
9
|
+
from asyncio_for_ynab import AccountsResponseData
|
|
10
|
+
from asyncio_for_ynab import AccountType
|
|
11
|
+
from asyncio_for_ynab import CategoriesResponse
|
|
12
|
+
from asyncio_for_ynab import CategoriesResponseData
|
|
13
|
+
from asyncio_for_ynab import Category
|
|
14
|
+
from asyncio_for_ynab import CategoryGroupWithCategories
|
|
15
|
+
from asyncio_for_ynab import CurrencyFormat
|
|
16
|
+
from asyncio_for_ynab import Payee
|
|
17
|
+
from asyncio_for_ynab import PayeesResponse
|
|
18
|
+
from asyncio_for_ynab import PayeesResponseData
|
|
19
|
+
from asyncio_for_ynab import PlanSummary
|
|
20
|
+
from asyncio_for_ynab import PlanSummaryResponse
|
|
21
|
+
from asyncio_for_ynab import PlanSummaryResponseData
|
|
22
|
+
from asyncio_for_ynab import ScheduledSubTransaction
|
|
23
|
+
from asyncio_for_ynab import ScheduledTransactionDetail
|
|
24
|
+
from asyncio_for_ynab import ScheduledTransactionsResponse
|
|
25
|
+
from asyncio_for_ynab import ScheduledTransactionsResponseData
|
|
26
|
+
from asyncio_for_ynab import SubTransaction
|
|
27
|
+
from asyncio_for_ynab import TransactionClearedStatus
|
|
28
|
+
from asyncio_for_ynab import TransactionDetail
|
|
29
|
+
from asyncio_for_ynab import TransactionsResponse
|
|
30
|
+
from asyncio_for_ynab import TransactionsResponseData
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
PLAN_ID_1 = str(uuid4())
|
|
34
|
+
PLAN_ID_2 = str(uuid4())
|
|
35
|
+
|
|
36
|
+
PLANS: list[PlanSummary] = [
|
|
37
|
+
PlanSummary(
|
|
38
|
+
id=UUID(PLAN_ID_1),
|
|
39
|
+
name="Plan 1",
|
|
40
|
+
currency_format=CurrencyFormat(
|
|
41
|
+
currency_symbol="$",
|
|
42
|
+
decimal_digits=2,
|
|
43
|
+
decimal_separator=".",
|
|
44
|
+
display_symbol=True,
|
|
45
|
+
example_format="123,456.78",
|
|
46
|
+
group_separator=",",
|
|
47
|
+
iso_code="USD",
|
|
48
|
+
symbol_first=True,
|
|
49
|
+
),
|
|
50
|
+
),
|
|
51
|
+
PlanSummary(
|
|
52
|
+
id=UUID(PLAN_ID_2),
|
|
53
|
+
name="Plan 2",
|
|
54
|
+
currency_format=CurrencyFormat(
|
|
55
|
+
currency_symbol="$",
|
|
56
|
+
decimal_digits=2,
|
|
57
|
+
decimal_separator=".",
|
|
58
|
+
display_symbol=True,
|
|
59
|
+
example_format="123,456.78",
|
|
60
|
+
group_separator=",",
|
|
61
|
+
iso_code="USD",
|
|
62
|
+
symbol_first=True,
|
|
63
|
+
),
|
|
64
|
+
),
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
SERVER_KNOWLEDGE_1 = 107667
|
|
68
|
+
SERVER_KNOWLEDGE_2 = 107668
|
|
69
|
+
|
|
70
|
+
LKOS = {
|
|
71
|
+
PLAN_ID_1: SERVER_KNOWLEDGE_1,
|
|
72
|
+
PLAN_ID_2: SERVER_KNOWLEDGE_2,
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
PAYEE_ID_1 = str(uuid4())
|
|
76
|
+
PAYEE_ID_2 = str(uuid4())
|
|
77
|
+
|
|
78
|
+
ACCOUNT_ID_1 = str(uuid4())
|
|
79
|
+
ACCOUNT_ID_2 = str(uuid4())
|
|
80
|
+
|
|
81
|
+
ACCOUNTS: list[Account] = [
|
|
82
|
+
Account(
|
|
83
|
+
id=UUID(ACCOUNT_ID_1),
|
|
84
|
+
name="Account 1",
|
|
85
|
+
type=AccountType.CHECKING,
|
|
86
|
+
on_budget=True,
|
|
87
|
+
closed=False,
|
|
88
|
+
note=None,
|
|
89
|
+
balance=160000,
|
|
90
|
+
cleared_balance=120000,
|
|
91
|
+
uncleared_balance=40000,
|
|
92
|
+
transfer_payee_id=UUID(PAYEE_ID_1),
|
|
93
|
+
direct_import_linked=None,
|
|
94
|
+
direct_import_in_error=None,
|
|
95
|
+
last_reconciled_at=None,
|
|
96
|
+
debt_original_balance=None,
|
|
97
|
+
debt_interest_rates={"2024-02-01": 5000},
|
|
98
|
+
debt_minimum_payments={},
|
|
99
|
+
debt_escrow_amounts={"2024-01-01": 160000},
|
|
100
|
+
deleted=False,
|
|
101
|
+
balance_formatted="$160.00",
|
|
102
|
+
balance_currency=160.0,
|
|
103
|
+
cleared_balance_formatted="$120.00",
|
|
104
|
+
cleared_balance_currency=120.0,
|
|
105
|
+
uncleared_balance_formatted="$40.00",
|
|
106
|
+
uncleared_balance_currency=40.0,
|
|
107
|
+
),
|
|
108
|
+
Account(
|
|
109
|
+
id=UUID(ACCOUNT_ID_2),
|
|
110
|
+
name="Account 2",
|
|
111
|
+
type=AccountType.SAVINGS,
|
|
112
|
+
on_budget=True,
|
|
113
|
+
closed=False,
|
|
114
|
+
note=None,
|
|
115
|
+
balance=25000,
|
|
116
|
+
cleared_balance=25000,
|
|
117
|
+
uncleared_balance=0,
|
|
118
|
+
transfer_payee_id=UUID(PAYEE_ID_2),
|
|
119
|
+
direct_import_linked=None,
|
|
120
|
+
direct_import_in_error=None,
|
|
121
|
+
last_reconciled_at=None,
|
|
122
|
+
debt_original_balance=None,
|
|
123
|
+
debt_interest_rates={},
|
|
124
|
+
debt_minimum_payments={},
|
|
125
|
+
debt_escrow_amounts={},
|
|
126
|
+
deleted=False,
|
|
127
|
+
balance_formatted="$25.00",
|
|
128
|
+
balance_currency=25.0,
|
|
129
|
+
cleared_balance_formatted="$25.00",
|
|
130
|
+
cleared_balance_currency=25.0,
|
|
131
|
+
uncleared_balance_formatted="$0.00",
|
|
132
|
+
uncleared_balance_currency=0.0,
|
|
133
|
+
),
|
|
134
|
+
]
|
|
135
|
+
|
|
136
|
+
CATEGORY_GROUP_ID_1 = str(uuid4())
|
|
137
|
+
CATEGORY_GROUP_ID_2 = str(uuid4())
|
|
138
|
+
|
|
139
|
+
CATEGORY_GROUP_NAME_1 = "Category Group 1"
|
|
140
|
+
CATEGORY_GROUP_NAME_2 = "Category Group 2"
|
|
141
|
+
|
|
142
|
+
CATEGORY_ID_1 = str(uuid4())
|
|
143
|
+
CATEGORY_ID_2 = str(uuid4())
|
|
144
|
+
CATEGORY_ID_3 = str(uuid4())
|
|
145
|
+
CATEGORY_ID_4 = str(uuid4())
|
|
146
|
+
|
|
147
|
+
CATEGORY_NAME_1 = "Category 1"
|
|
148
|
+
CATEGORY_NAME_2 = "Category 2"
|
|
149
|
+
CATEGORY_NAME_3 = "Category 3"
|
|
150
|
+
CATEGORY_NAME_4 = "Category 4"
|
|
151
|
+
CATEGORY_GOAL_TARGET_DATE_1 = "2026-12-31"
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
CATEGORY_GROUPS: list[CategoryGroupWithCategories] = [
|
|
155
|
+
CategoryGroupWithCategories(
|
|
156
|
+
id=UUID(CATEGORY_GROUP_ID_1),
|
|
157
|
+
name=CATEGORY_GROUP_NAME_1,
|
|
158
|
+
hidden=False,
|
|
159
|
+
internal=False,
|
|
160
|
+
deleted=False,
|
|
161
|
+
categories=[
|
|
162
|
+
Category(
|
|
163
|
+
id=UUID(CATEGORY_ID_1),
|
|
164
|
+
category_group_id=UUID(CATEGORY_GROUP_ID_1),
|
|
165
|
+
category_group_name=CATEGORY_GROUP_NAME_1,
|
|
166
|
+
name=CATEGORY_NAME_1,
|
|
167
|
+
hidden=False,
|
|
168
|
+
internal=False,
|
|
169
|
+
original_category_group_id=None,
|
|
170
|
+
note=None,
|
|
171
|
+
budgeted=14500,
|
|
172
|
+
activity=2500,
|
|
173
|
+
balance=12000,
|
|
174
|
+
goal_type=None,
|
|
175
|
+
goal_needs_whole_amount=None,
|
|
176
|
+
goal_day=None,
|
|
177
|
+
goal_cadence=None,
|
|
178
|
+
goal_cadence_frequency=None,
|
|
179
|
+
goal_creation_month=None,
|
|
180
|
+
goal_target=20000,
|
|
181
|
+
goal_target_month=None,
|
|
182
|
+
goal_target_date=date.fromisoformat(CATEGORY_GOAL_TARGET_DATE_1),
|
|
183
|
+
goal_percentage_complete=None,
|
|
184
|
+
goal_months_to_budget=None,
|
|
185
|
+
goal_under_funded=8000,
|
|
186
|
+
goal_overall_funded=12000,
|
|
187
|
+
goal_overall_left=8000,
|
|
188
|
+
goal_snoozed_at=None,
|
|
189
|
+
deleted=False,
|
|
190
|
+
balance_formatted="$12.00",
|
|
191
|
+
balance_currency=12.0,
|
|
192
|
+
activity_formatted="$2.50",
|
|
193
|
+
activity_currency=2.5,
|
|
194
|
+
budgeted_formatted="$14.50",
|
|
195
|
+
budgeted_currency=14.5,
|
|
196
|
+
goal_target_formatted="$20.00",
|
|
197
|
+
goal_target_currency=20.0,
|
|
198
|
+
goal_under_funded_formatted="$8.00",
|
|
199
|
+
goal_under_funded_currency=8.0,
|
|
200
|
+
goal_overall_funded_formatted="$12.00",
|
|
201
|
+
goal_overall_funded_currency=12.0,
|
|
202
|
+
goal_overall_left_formatted="$8.00",
|
|
203
|
+
goal_overall_left_currency=8.0,
|
|
204
|
+
),
|
|
205
|
+
Category(
|
|
206
|
+
id=UUID(CATEGORY_ID_2),
|
|
207
|
+
category_group_id=UUID(CATEGORY_GROUP_ID_1),
|
|
208
|
+
category_group_name=CATEGORY_GROUP_NAME_1,
|
|
209
|
+
name=CATEGORY_NAME_2,
|
|
210
|
+
hidden=False,
|
|
211
|
+
internal=False,
|
|
212
|
+
original_category_group_id=None,
|
|
213
|
+
note=None,
|
|
214
|
+
budgeted=10250,
|
|
215
|
+
activity=1000,
|
|
216
|
+
balance=9250,
|
|
217
|
+
goal_type=None,
|
|
218
|
+
goal_needs_whole_amount=None,
|
|
219
|
+
goal_day=None,
|
|
220
|
+
goal_cadence=None,
|
|
221
|
+
goal_cadence_frequency=None,
|
|
222
|
+
goal_creation_month=None,
|
|
223
|
+
goal_target=None,
|
|
224
|
+
goal_target_month=None,
|
|
225
|
+
goal_target_date=None,
|
|
226
|
+
goal_percentage_complete=None,
|
|
227
|
+
goal_months_to_budget=None,
|
|
228
|
+
goal_under_funded=None,
|
|
229
|
+
goal_overall_funded=None,
|
|
230
|
+
goal_overall_left=None,
|
|
231
|
+
goal_snoozed_at=None,
|
|
232
|
+
deleted=False,
|
|
233
|
+
balance_formatted="$9.25",
|
|
234
|
+
balance_currency=9.25,
|
|
235
|
+
activity_formatted="$1.00",
|
|
236
|
+
activity_currency=1.0,
|
|
237
|
+
budgeted_formatted="$10.25",
|
|
238
|
+
budgeted_currency=10.25,
|
|
239
|
+
goal_target_formatted=None,
|
|
240
|
+
goal_target_currency=None,
|
|
241
|
+
goal_under_funded_formatted=None,
|
|
242
|
+
goal_under_funded_currency=None,
|
|
243
|
+
goal_overall_funded_formatted=None,
|
|
244
|
+
goal_overall_funded_currency=None,
|
|
245
|
+
goal_overall_left_formatted=None,
|
|
246
|
+
goal_overall_left_currency=None,
|
|
247
|
+
),
|
|
248
|
+
],
|
|
249
|
+
),
|
|
250
|
+
CategoryGroupWithCategories(
|
|
251
|
+
id=UUID(CATEGORY_GROUP_ID_2),
|
|
252
|
+
name=CATEGORY_GROUP_NAME_2,
|
|
253
|
+
hidden=False,
|
|
254
|
+
internal=False,
|
|
255
|
+
deleted=False,
|
|
256
|
+
categories=[
|
|
257
|
+
Category(
|
|
258
|
+
id=UUID(CATEGORY_ID_3),
|
|
259
|
+
category_group_id=UUID(CATEGORY_GROUP_ID_2),
|
|
260
|
+
category_group_name=CATEGORY_GROUP_NAME_2,
|
|
261
|
+
name=CATEGORY_NAME_3,
|
|
262
|
+
hidden=False,
|
|
263
|
+
internal=False,
|
|
264
|
+
original_category_group_id=None,
|
|
265
|
+
note=None,
|
|
266
|
+
budgeted=15000,
|
|
267
|
+
activity=7500,
|
|
268
|
+
balance=7500,
|
|
269
|
+
goal_type=None,
|
|
270
|
+
goal_needs_whole_amount=None,
|
|
271
|
+
goal_day=None,
|
|
272
|
+
goal_cadence=None,
|
|
273
|
+
goal_cadence_frequency=None,
|
|
274
|
+
goal_creation_month=None,
|
|
275
|
+
goal_target=None,
|
|
276
|
+
goal_target_month=None,
|
|
277
|
+
goal_target_date=None,
|
|
278
|
+
goal_percentage_complete=None,
|
|
279
|
+
goal_months_to_budget=None,
|
|
280
|
+
goal_under_funded=None,
|
|
281
|
+
goal_overall_funded=None,
|
|
282
|
+
goal_overall_left=None,
|
|
283
|
+
goal_snoozed_at=None,
|
|
284
|
+
deleted=False,
|
|
285
|
+
balance_formatted="$7.50",
|
|
286
|
+
balance_currency=7.5,
|
|
287
|
+
activity_formatted="$7.50",
|
|
288
|
+
activity_currency=7.5,
|
|
289
|
+
budgeted_formatted="$15.00",
|
|
290
|
+
budgeted_currency=15.0,
|
|
291
|
+
goal_target_formatted=None,
|
|
292
|
+
goal_target_currency=None,
|
|
293
|
+
goal_under_funded_formatted=None,
|
|
294
|
+
goal_under_funded_currency=None,
|
|
295
|
+
goal_overall_funded_formatted=None,
|
|
296
|
+
goal_overall_funded_currency=None,
|
|
297
|
+
goal_overall_left_formatted=None,
|
|
298
|
+
goal_overall_left_currency=None,
|
|
299
|
+
),
|
|
300
|
+
Category(
|
|
301
|
+
id=UUID(CATEGORY_ID_4),
|
|
302
|
+
category_group_id=UUID(CATEGORY_GROUP_ID_2),
|
|
303
|
+
category_group_name=CATEGORY_GROUP_NAME_2,
|
|
304
|
+
name=CATEGORY_NAME_4,
|
|
305
|
+
hidden=False,
|
|
306
|
+
internal=False,
|
|
307
|
+
original_category_group_id=None,
|
|
308
|
+
note=None,
|
|
309
|
+
budgeted=20000,
|
|
310
|
+
activity=19000,
|
|
311
|
+
balance=19000,
|
|
312
|
+
goal_type=None,
|
|
313
|
+
goal_needs_whole_amount=None,
|
|
314
|
+
goal_day=None,
|
|
315
|
+
goal_cadence=None,
|
|
316
|
+
goal_cadence_frequency=None,
|
|
317
|
+
goal_creation_month=None,
|
|
318
|
+
goal_target=None,
|
|
319
|
+
goal_target_month=None,
|
|
320
|
+
goal_target_date=None,
|
|
321
|
+
goal_percentage_complete=None,
|
|
322
|
+
goal_months_to_budget=None,
|
|
323
|
+
goal_under_funded=None,
|
|
324
|
+
goal_overall_funded=None,
|
|
325
|
+
goal_overall_left=None,
|
|
326
|
+
goal_snoozed_at=None,
|
|
327
|
+
deleted=False,
|
|
328
|
+
balance_formatted="$19.00",
|
|
329
|
+
balance_currency=19.0,
|
|
330
|
+
activity_formatted="$19.00",
|
|
331
|
+
activity_currency=19.0,
|
|
332
|
+
budgeted_formatted="$20.00",
|
|
333
|
+
budgeted_currency=20.0,
|
|
334
|
+
goal_target_formatted=None,
|
|
335
|
+
goal_target_currency=None,
|
|
336
|
+
goal_under_funded_formatted=None,
|
|
337
|
+
goal_under_funded_currency=None,
|
|
338
|
+
goal_overall_funded_formatted=None,
|
|
339
|
+
goal_overall_funded_currency=None,
|
|
340
|
+
goal_overall_left_formatted=None,
|
|
341
|
+
goal_overall_left_currency=None,
|
|
342
|
+
),
|
|
343
|
+
],
|
|
344
|
+
),
|
|
345
|
+
]
|
|
346
|
+
|
|
347
|
+
PAYEES: list[Payee] = [
|
|
348
|
+
Payee(id=UUID(PAYEE_ID_1), name="Payee 1", transfer_account_id=None, deleted=False),
|
|
349
|
+
Payee(id=UUID(PAYEE_ID_2), name="Payee 2", transfer_account_id=None, deleted=False),
|
|
350
|
+
]
|
|
351
|
+
|
|
352
|
+
TRANSACTION_ID_1 = str(uuid4())
|
|
353
|
+
TRANSACTION_ID_2 = str(uuid4())
|
|
354
|
+
TRANSACTION_ID_3 = str(uuid4())
|
|
355
|
+
|
|
356
|
+
SUBTRANSACTION_ID_1 = str(uuid4())
|
|
357
|
+
SUBTRANSACTION_ID_2 = str(uuid4())
|
|
358
|
+
|
|
359
|
+
TRANSACTIONS: list[TransactionDetail] = [
|
|
360
|
+
TransactionDetail(
|
|
361
|
+
id=TRANSACTION_ID_1,
|
|
362
|
+
date=date.fromisoformat("2024-01-01"),
|
|
363
|
+
amount=-10000,
|
|
364
|
+
memo=None,
|
|
365
|
+
cleared=TransactionClearedStatus.CLEARED,
|
|
366
|
+
approved=True,
|
|
367
|
+
flag_color=None,
|
|
368
|
+
flag_name=None,
|
|
369
|
+
account_id=UUID(ACCOUNT_ID_1),
|
|
370
|
+
payee_id=None,
|
|
371
|
+
category_id=UUID(CATEGORY_ID_3),
|
|
372
|
+
transfer_account_id=None,
|
|
373
|
+
transfer_transaction_id=None,
|
|
374
|
+
matched_transaction_id=None,
|
|
375
|
+
import_id=None,
|
|
376
|
+
import_payee_name=None,
|
|
377
|
+
import_payee_name_original=None,
|
|
378
|
+
debt_transaction_type=None,
|
|
379
|
+
deleted=False,
|
|
380
|
+
amount_formatted="$10.00",
|
|
381
|
+
amount_currency=10.0,
|
|
382
|
+
account_name="Account 1",
|
|
383
|
+
payee_name=None,
|
|
384
|
+
category_name=CATEGORY_NAME_3,
|
|
385
|
+
subtransactions=[
|
|
386
|
+
SubTransaction(
|
|
387
|
+
id=SUBTRANSACTION_ID_1,
|
|
388
|
+
transaction_id=TRANSACTION_ID_1,
|
|
389
|
+
amount=-7500,
|
|
390
|
+
memo=None,
|
|
391
|
+
payee_id=None,
|
|
392
|
+
payee_name=None,
|
|
393
|
+
category_id=UUID(CATEGORY_ID_1),
|
|
394
|
+
category_name=CATEGORY_NAME_1,
|
|
395
|
+
transfer_account_id=None,
|
|
396
|
+
transfer_transaction_id=None,
|
|
397
|
+
deleted=False,
|
|
398
|
+
amount_formatted="$7.50",
|
|
399
|
+
amount_currency=7.5,
|
|
400
|
+
),
|
|
401
|
+
SubTransaction(
|
|
402
|
+
id=SUBTRANSACTION_ID_2,
|
|
403
|
+
transaction_id=TRANSACTION_ID_1,
|
|
404
|
+
amount=-2500,
|
|
405
|
+
memo=None,
|
|
406
|
+
payee_id=None,
|
|
407
|
+
payee_name=None,
|
|
408
|
+
category_id=UUID(CATEGORY_ID_2),
|
|
409
|
+
category_name=CATEGORY_NAME_2,
|
|
410
|
+
transfer_account_id=None,
|
|
411
|
+
transfer_transaction_id=None,
|
|
412
|
+
deleted=False,
|
|
413
|
+
amount_formatted="$2.50",
|
|
414
|
+
amount_currency=2.5,
|
|
415
|
+
),
|
|
416
|
+
],
|
|
417
|
+
),
|
|
418
|
+
TransactionDetail(
|
|
419
|
+
id=TRANSACTION_ID_2,
|
|
420
|
+
date=date.fromisoformat("2024-02-01"),
|
|
421
|
+
amount=-15000,
|
|
422
|
+
memo=None,
|
|
423
|
+
cleared=TransactionClearedStatus.CLEARED,
|
|
424
|
+
approved=True,
|
|
425
|
+
flag_color=None,
|
|
426
|
+
flag_name=None,
|
|
427
|
+
account_id=UUID(ACCOUNT_ID_1),
|
|
428
|
+
payee_id=None,
|
|
429
|
+
category_id=UUID(CATEGORY_ID_2),
|
|
430
|
+
transfer_account_id=None,
|
|
431
|
+
transfer_transaction_id=None,
|
|
432
|
+
matched_transaction_id=None,
|
|
433
|
+
import_id=None,
|
|
434
|
+
import_payee_name=None,
|
|
435
|
+
import_payee_name_original=None,
|
|
436
|
+
debt_transaction_type=None,
|
|
437
|
+
deleted=True,
|
|
438
|
+
amount_formatted="$15.00",
|
|
439
|
+
amount_currency=15.0,
|
|
440
|
+
account_name="Account 1",
|
|
441
|
+
payee_name=None,
|
|
442
|
+
category_name=CATEGORY_NAME_2,
|
|
443
|
+
subtransactions=[],
|
|
444
|
+
),
|
|
445
|
+
TransactionDetail(
|
|
446
|
+
id=TRANSACTION_ID_3,
|
|
447
|
+
date=date.fromisoformat("2024-03-01"),
|
|
448
|
+
amount=-19000,
|
|
449
|
+
memo=None,
|
|
450
|
+
cleared=TransactionClearedStatus.UNCLEARED,
|
|
451
|
+
approved=False,
|
|
452
|
+
flag_color=None,
|
|
453
|
+
flag_name=None,
|
|
454
|
+
account_id=UUID(ACCOUNT_ID_1),
|
|
455
|
+
payee_id=None,
|
|
456
|
+
category_id=UUID(CATEGORY_ID_4),
|
|
457
|
+
transfer_account_id=None,
|
|
458
|
+
transfer_transaction_id=None,
|
|
459
|
+
matched_transaction_id=None,
|
|
460
|
+
import_id=None,
|
|
461
|
+
import_payee_name=None,
|
|
462
|
+
import_payee_name_original=None,
|
|
463
|
+
debt_transaction_type=None,
|
|
464
|
+
deleted=False,
|
|
465
|
+
amount_formatted="$19.00",
|
|
466
|
+
amount_currency=19.0,
|
|
467
|
+
account_name="Account 1",
|
|
468
|
+
payee_name=None,
|
|
469
|
+
category_name=CATEGORY_NAME_4,
|
|
470
|
+
subtransactions=[],
|
|
471
|
+
),
|
|
472
|
+
]
|
|
473
|
+
|
|
474
|
+
SCHEDULED_TRANSACTION_ID_1 = str(uuid4())
|
|
475
|
+
SCHEDULED_TRANSACTION_ID_2 = str(uuid4())
|
|
476
|
+
SCHEDULED_TRANSACTION_ID_3 = str(uuid4())
|
|
477
|
+
|
|
478
|
+
SCHEDULED_SUBTRANSACTION_ID_1 = str(uuid4())
|
|
479
|
+
SCHEDULED_SUBTRANSACTION_ID_2 = str(uuid4())
|
|
480
|
+
|
|
481
|
+
SCHEDULED_TRANSACTIONS: list[ScheduledTransactionDetail] = [
|
|
482
|
+
ScheduledTransactionDetail(
|
|
483
|
+
id=UUID(SCHEDULED_TRANSACTION_ID_1),
|
|
484
|
+
date_first=date.fromisoformat("2024-01-01"),
|
|
485
|
+
date_next=date.fromisoformat("2024-01-01"),
|
|
486
|
+
frequency="monthly",
|
|
487
|
+
amount=-12000,
|
|
488
|
+
memo=None,
|
|
489
|
+
flag_color=None,
|
|
490
|
+
flag_name=None,
|
|
491
|
+
account_id=UUID(ACCOUNT_ID_1),
|
|
492
|
+
payee_id=None,
|
|
493
|
+
category_id=UUID(CATEGORY_ID_1),
|
|
494
|
+
transfer_account_id=None,
|
|
495
|
+
deleted=False,
|
|
496
|
+
amount_formatted="$12.00",
|
|
497
|
+
amount_currency=12.0,
|
|
498
|
+
account_name="Account 1",
|
|
499
|
+
payee_name=None,
|
|
500
|
+
category_name=CATEGORY_NAME_1,
|
|
501
|
+
subtransactions=[
|
|
502
|
+
ScheduledSubTransaction(
|
|
503
|
+
id=UUID(SCHEDULED_SUBTRANSACTION_ID_1),
|
|
504
|
+
scheduled_transaction_id=UUID(SCHEDULED_TRANSACTION_ID_1),
|
|
505
|
+
amount=-8040,
|
|
506
|
+
memo=None,
|
|
507
|
+
payee_id=None,
|
|
508
|
+
payee_name=None,
|
|
509
|
+
category_id=UUID(CATEGORY_ID_2),
|
|
510
|
+
category_name=CATEGORY_NAME_2,
|
|
511
|
+
transfer_account_id=None,
|
|
512
|
+
deleted=False,
|
|
513
|
+
amount_formatted="$8.04",
|
|
514
|
+
amount_currency=8.04,
|
|
515
|
+
),
|
|
516
|
+
ScheduledSubTransaction(
|
|
517
|
+
id=UUID(SCHEDULED_SUBTRANSACTION_ID_2),
|
|
518
|
+
scheduled_transaction_id=UUID(SCHEDULED_TRANSACTION_ID_1),
|
|
519
|
+
amount=-2960,
|
|
520
|
+
memo=None,
|
|
521
|
+
payee_id=None,
|
|
522
|
+
payee_name=None,
|
|
523
|
+
category_id=UUID(CATEGORY_ID_3),
|
|
524
|
+
category_name=CATEGORY_NAME_3,
|
|
525
|
+
transfer_account_id=None,
|
|
526
|
+
deleted=False,
|
|
527
|
+
amount_formatted="$2.96",
|
|
528
|
+
amount_currency=2.96,
|
|
529
|
+
),
|
|
530
|
+
],
|
|
531
|
+
),
|
|
532
|
+
ScheduledTransactionDetail(
|
|
533
|
+
id=UUID(SCHEDULED_TRANSACTION_ID_2),
|
|
534
|
+
date_first=date.fromisoformat("2024-02-01"),
|
|
535
|
+
date_next=date.fromisoformat("2024-02-01"),
|
|
536
|
+
frequency="yearly",
|
|
537
|
+
amount=-11000,
|
|
538
|
+
memo=None,
|
|
539
|
+
flag_color=None,
|
|
540
|
+
flag_name=None,
|
|
541
|
+
account_id=UUID(ACCOUNT_ID_1),
|
|
542
|
+
payee_id=None,
|
|
543
|
+
category_id=UUID(CATEGORY_ID_3),
|
|
544
|
+
transfer_account_id=None,
|
|
545
|
+
deleted=True,
|
|
546
|
+
amount_formatted="$11.00",
|
|
547
|
+
amount_currency=11.0,
|
|
548
|
+
account_name="Account 1",
|
|
549
|
+
payee_name=None,
|
|
550
|
+
category_name=CATEGORY_NAME_3,
|
|
551
|
+
subtransactions=[],
|
|
552
|
+
),
|
|
553
|
+
ScheduledTransactionDetail(
|
|
554
|
+
id=UUID(SCHEDULED_TRANSACTION_ID_3),
|
|
555
|
+
date_first=date.fromisoformat("2024-03-01"),
|
|
556
|
+
date_next=date.fromisoformat("2024-03-01"),
|
|
557
|
+
frequency="everyOtherMonth",
|
|
558
|
+
amount=-9000,
|
|
559
|
+
memo=None,
|
|
560
|
+
flag_color=None,
|
|
561
|
+
flag_name=None,
|
|
562
|
+
account_id=UUID(ACCOUNT_ID_1),
|
|
563
|
+
payee_id=None,
|
|
564
|
+
category_id=UUID(CATEGORY_ID_4),
|
|
565
|
+
transfer_account_id=None,
|
|
566
|
+
deleted=False,
|
|
567
|
+
amount_formatted="$9.00",
|
|
568
|
+
amount_currency=9.0,
|
|
569
|
+
account_name="Account 1",
|
|
570
|
+
payee_name=None,
|
|
571
|
+
category_name=CATEGORY_NAME_4,
|
|
572
|
+
subtransactions=[],
|
|
573
|
+
),
|
|
574
|
+
]
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
def plan_response(plans: list[PlanSummary]) -> PlanSummaryResponse:
|
|
578
|
+
return PlanSummaryResponse(data=PlanSummaryResponseData(plans=plans))
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
def accounts_response(
|
|
582
|
+
accounts: list[Account], server_knowledge: int
|
|
583
|
+
) -> AccountsResponse:
|
|
584
|
+
return AccountsResponse(
|
|
585
|
+
data=AccountsResponseData(accounts=accounts, server_knowledge=server_knowledge)
|
|
586
|
+
)
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
def categories_response(
|
|
590
|
+
category_groups: list[CategoryGroupWithCategories], server_knowledge: int
|
|
591
|
+
) -> CategoriesResponse:
|
|
592
|
+
return CategoriesResponse(
|
|
593
|
+
data=CategoriesResponseData(
|
|
594
|
+
category_groups=category_groups, server_knowledge=server_knowledge
|
|
595
|
+
)
|
|
596
|
+
)
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
def payees_response(payees: list[Payee], server_knowledge: int) -> PayeesResponse:
|
|
600
|
+
return PayeesResponse(
|
|
601
|
+
data=PayeesResponseData(payees=payees, server_knowledge=server_knowledge)
|
|
602
|
+
)
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
def transactions_response(
|
|
606
|
+
transactions: list[TransactionDetail], server_knowledge: int
|
|
607
|
+
) -> TransactionsResponse:
|
|
608
|
+
return TransactionsResponse(
|
|
609
|
+
data=TransactionsResponseData(
|
|
610
|
+
transactions=transactions, server_knowledge=server_knowledge
|
|
611
|
+
)
|
|
612
|
+
)
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
def scheduled_transactions_response(
|
|
616
|
+
scheduled_transactions: list[ScheduledTransactionDetail], server_knowledge: int
|
|
617
|
+
) -> ScheduledTransactionsResponse:
|
|
618
|
+
return ScheduledTransactionsResponse(
|
|
619
|
+
data=ScheduledTransactionsResponseData(
|
|
620
|
+
scheduled_transactions=scheduled_transactions,
|
|
621
|
+
server_knowledge=server_knowledge,
|
|
622
|
+
)
|
|
623
|
+
)
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
TOKEN = f"token-{uuid4()}"
|
tests/__init__.py
ADDED
|
File without changes
|