Skip to content

Commit 636f483

Browse files
authored
Update _main_test.py
1 parent 176d3ab commit 636f483

1 file changed

Lines changed: 34 additions & 11 deletions

File tree

tests/_main_test.py

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
from testing.fixtures import SCHEDULED_SUBTRANSACTION_ID_2
6262
from testing.fixtures import SCHEDULED_TRANSACTION_ID_1
6363
from testing.fixtures import SCHEDULED_TRANSACTION_ID_2
64+
from testing.fixtures import SCHEDULED_TRANSACTION_ID_3
6465
from testing.fixtures import SCHEDULED_TRANSACTIONS
6566
from testing.fixtures import SCHEDULED_TRANSACTIONS_ENDPOINT_RE
6667
from testing.fixtures import SERVER_KNOWLEDGE_1
@@ -70,6 +71,7 @@
7071
from testing.fixtures import TOKEN
7172
from testing.fixtures import TRANSACTION_ID_1
7273
from testing.fixtures import TRANSACTION_ID_2
74+
from testing.fixtures import TRANSACTION_ID_3
7375
from testing.fixtures import TRANSACTIONS
7476
from testing.fixtures import TRANSACTIONS_ENDPOINT_RE
7577

@@ -105,7 +107,7 @@ def test_insert_budgets(cur):
105107
{
106108
"id": BUDGET_ID_1,
107109
"name": BUDGETS[0]["name"],
108-
"currency_format_currency_symbol": "$",
110+
"currency_format_currency_symbol": "$",
109111
"currency_format_decimal_digits": 2,
110112
"currency_format_decimal_separator": ".",
111113
"currency_format_display_symbol": 1,
@@ -117,7 +119,7 @@ def test_insert_budgets(cur):
117119
{
118120
"id": BUDGET_ID_2,
119121
"name": BUDGETS[1]["name"],
120-
"currency_format_currency_symbol": "$",
122+
"currency_format_currency_symbol": "$",
121123
"currency_format_decimal_digits": 2,
122124
"currency_format_decimal_separator": ".",
123125
"currency_format_display_symbol": 1,
@@ -256,12 +258,21 @@ def test_insert_transactions(cur):
256258
"budget_id": BUDGET_ID_1,
257259
"date": "2024-01-01",
258260
"amount": -10000,
261+
"deleted": False,
259262
},
260263
{
261264
"id": TRANSACTION_ID_2,
262265
"budget_id": BUDGET_ID_1,
263266
"date": "2024-02-01",
264267
"amount": -15000,
268+
"deleted": True,
269+
},
270+
{
271+
"id": TRANSACTION_ID_3,
272+
"budget_id": BUDGET_ID_1,
273+
"date": "2024-03-01",
274+
"amount": -19000,
275+
"deleted": False,
265276
},
266277
]
267278

@@ -272,24 +283,26 @@ def test_insert_transactions(cur):
272283
"transaction_id": TRANSACTION_ID_1,
273284
"budget_id": BUDGET_ID_1,
274285
"amount": -7500,
286+
"deleted": False,
275287
},
276288
{
277289
"id": SUBTRANSACTION_ID_2,
278290
"transaction_id": TRANSACTION_ID_1,
279291
"budget_id": BUDGET_ID_1,
280292
"amount": -2500,
293+
"deleted": False,
281294
},
282295
]
283296

284297
cur.execute("SELECT * FROM flat_transactions ORDER BY amount")
285298
assert [strip_nones(d) for d in cur.fetchall()] == [
286299
{
287-
"transaction_id": TRANSACTION_ID_2,
300+
"transaction_id": TRANSACTION_ID_3,
288301
"budget_id": BUDGET_ID_1,
289-
"date": "2024-02-01",
290-
"id": TRANSACTION_ID_2,
291-
"amount": -15000,
292-
"amount_major": pytest.approx(15),
302+
"date": "2024-03-01",
303+
"id": TRANSACTION_ID_3,
304+
"amount": -19000,
305+
"amount_major": pytest.approx(19),
293306
},
294307
{
295308
"transaction_id": TRANSACTION_ID_1,
@@ -325,11 +338,19 @@ def test_insert_scheduled_transactions(cur):
325338
"id": SCHEDULED_TRANSACTION_ID_1,
326339
"budget_id": BUDGET_ID_1,
327340
"amount": -12000,
341+
"deleted": False,
328342
},
329343
{
330344
"id": SCHEDULED_TRANSACTION_ID_2,
331345
"budget_id": BUDGET_ID_1,
332346
"amount": -11000,
347+
"deleted": True,
348+
},
349+
{
350+
"id": SCHEDULED_TRANSACTION_ID_3,
351+
"budget_id": BUDGET_ID_1,
352+
"amount": -9000,
353+
"deleted": False,
333354
},
334355
]
335356

@@ -340,23 +361,25 @@ def test_insert_scheduled_transactions(cur):
340361
"scheduled_transaction_id": SCHEDULED_TRANSACTION_ID_1,
341362
"budget_id": BUDGET_ID_1,
342363
"amount": -8040,
364+
"deleted": False,
343365
},
344366
{
345367
"id": SCHEDULED_SUBTRANSACTION_ID_2,
346368
"scheduled_transaction_id": SCHEDULED_TRANSACTION_ID_1,
347369
"budget_id": BUDGET_ID_1,
348370
"amount": -2960,
371+
"deleted": False,
349372
},
350373
]
351374

352375
cur.execute("SELECT * FROM scheduled_flat_transactions ORDER BY amount")
353376
assert [strip_nones(d) for d in cur.fetchall()] == [
354377
{
355-
"transaction_id": SCHEDULED_TRANSACTION_ID_2,
378+
"transaction_id": SCHEDULED_TRANSACTION_ID_3,
356379
"budget_id": BUDGET_ID_1,
357-
"id": SCHEDULED_TRANSACTION_ID_2,
358-
"amount": -11000,
359-
"amount_major": pytest.approx(11),
380+
"id": SCHEDULED_TRANSACTION_ID_3,
381+
"amount": -9000,
382+
"amount_major": pytest.approx(9),
360383
},
361384
{
362385
"transaction_id": SCHEDULED_TRANSACTION_ID_1,

0 commit comments

Comments
 (0)