|
1 | | -from figo.models import Account, BankContact, AccountBalance, Payment, \ |
2 | | - Transaction, Notification, SynchronizationStatus, User, Service, \ |
3 | | - LoginSettings, Credential, TaskToken, TaskState, Challenge, PaymentProposal, \ |
4 | | - Process, ProcessStep, ProcessOptions, Security |
| 1 | +from figo.models import Account |
| 2 | +from figo.models import AccountBalance |
| 3 | +from figo.models import BankContact |
| 4 | +from figo.models import Category |
| 5 | +from figo.models import Challenge |
| 6 | +from figo.models import Credential |
| 7 | +from figo.models import LoginSettings |
| 8 | +from figo.models import Notification |
| 9 | +from figo.models import Payment |
| 10 | +from figo.models import PaymentProposal |
| 11 | +from figo.models import Process |
| 12 | +from figo.models import ProcessOptions |
| 13 | +from figo.models import ProcessStep |
| 14 | +from figo.models import Security |
| 15 | +from figo.models import Service |
| 16 | +from figo.models import SynchronizationStatus |
| 17 | +from figo.models import TaskState |
| 18 | +from figo.models import TaskToken |
| 19 | +from figo.models import Transaction |
| 20 | +from figo.models import User |
5 | 21 |
|
6 | 22 |
|
7 | 23 | def test_create_account_from_dict(demo_session): |
@@ -107,6 +123,45 @@ def test_create_transaction_from_dict(demo_session): |
107 | 123 | assert isinstance(transaction, Transaction) |
108 | 124 |
|
109 | 125 |
|
| 126 | +def test_create_transaction_with_categories(demo_session): |
| 127 | + data = { |
| 128 | + "account_id": "A1.1", |
| 129 | + "account_number": "4711951501", |
| 130 | + "amount": -17.89, |
| 131 | + "bank_code": "90090042", |
| 132 | + "bank_name": "Demobank", |
| 133 | + "booked": False, |
| 134 | + "booking_date": "2013-04-11T12:00:00.000Z", |
| 135 | + "booking_text": "Ueberweisung", |
| 136 | + "creation_timestamp": "2013-04-11T13:54:02.000Z", |
| 137 | + "currency": "EUR", |
| 138 | + "modification_timestamp": "2013-04-11T13:54:02.000Z", |
| 139 | + "name": "Rogers Shipping, Inc.", |
| 140 | + "purpose": "Ihre Sendung 0815 vom 01.03.2012, Vielen Dank", |
| 141 | + "transaction_id": "T1.1.25", |
| 142 | + "type": "Transfer", |
| 143 | + "categories": [ |
| 144 | + { |
| 145 | + "parent_id": None, |
| 146 | + "id": 150, |
| 147 | + "name": "Lebenshaltung" |
| 148 | + }, |
| 149 | + { |
| 150 | + "parent_id": 150, |
| 151 | + "id": 162, |
| 152 | + "name": "Spende" |
| 153 | + } |
| 154 | + ], |
| 155 | + "value_date": "2013-04-11T12:00:00.000Z", |
| 156 | + "visited": True |
| 157 | + } |
| 158 | + transaction = Transaction.from_dict(demo_session, data) |
| 159 | + assert hasattr(transaction, 'categories') |
| 160 | + for category in transaction.categories: |
| 161 | + assert isinstance(category, Category) |
| 162 | + assert hasattr(category, 'id') |
| 163 | + |
| 164 | + |
110 | 165 | def test_create_notification_from_dict(demo_session): |
111 | 166 | data = { |
112 | 167 | "notification_id": "N1.7", |
|
0 commit comments