Skip to content

Commit 3280e88

Browse files
committed
Another test
1 parent aeb4a45 commit 3280e88

File tree

3 files changed

+212
-2
lines changed

3 files changed

+212
-2
lines changed

pytr/dl.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def dl_doc(self, doc, titleText, subtitleText, subfolder=None):
166166
return
167167
else:
168168
filepath = filepath_with_doc_id
169-
doc["local filepath"] = str(filepath)
169+
doc["local_filepath"] = str(filepath)
170170
self.filepaths.append(filepath)
171171

172172
if filepath.is_file() is False:

tests/sample_buy.json

+191
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
{
2+
"id": "12345678",
3+
"timestamp": "2024-02-20T16:32:07.731+0000",
4+
"title": "Euro Stoxx 50 EUR (Dist)",
5+
"icon": "logos/IE00B4K6B022/v2",
6+
"badge": null,
7+
"subtitle": "Kauforder",
8+
"amount": {
9+
"currency": "EUR",
10+
"value": -3002.8,
11+
"fractionDigits": 2
12+
},
13+
"subAmount": null,
14+
"status": "EXECUTED",
15+
"action": {
16+
"type": "timelineDetail",
17+
"payload": "12345678"
18+
},
19+
"eventType": "ORDER_EXECUTED",
20+
"source": "timelineTransaction",
21+
"details": {
22+
"id": "12345678",
23+
"sections": [
24+
{
25+
"title": "Du hast 3.002,80 € investiert",
26+
"data": {
27+
"icon": "logos/IE00B4K6B022/v2",
28+
"subtitleText": null,
29+
"timestamp": "2024-02-20T16:32:07.731+0000",
30+
"status": "executed"
31+
},
32+
"action": {
33+
"type": "instrumentDetail",
34+
"payload": "IE00B4K6B022"
35+
},
36+
"type": "header"
37+
},
38+
{
39+
"title": "Übersicht",
40+
"data": [
41+
{
42+
"title": "Status",
43+
"detail": {
44+
"text": "Ausgeführt",
45+
"functionalStyle": "EXECUTED",
46+
"type": "status"
47+
},
48+
"style": "plain"
49+
},
50+
{
51+
"title": "Orderart",
52+
"detail": {
53+
"text": "Kauf",
54+
"trend": null,
55+
"action": null,
56+
"type": "text"
57+
},
58+
"style": "plain"
59+
},
60+
{
61+
"title": "Asset",
62+
"detail": {
63+
"text": "Euro Stoxx 50 EUR (Dist)",
64+
"trend": null,
65+
"action": null,
66+
"type": "text"
67+
},
68+
"style": "plain"
69+
}
70+
],
71+
"action": null,
72+
"type": "table"
73+
},
74+
{
75+
"title": "Transaktion",
76+
"data": [
77+
{
78+
"title": "Anteile",
79+
"detail": {
80+
"text": "60",
81+
"trend": null,
82+
"action": null,
83+
"type": "text"
84+
},
85+
"style": "plain"
86+
},
87+
{
88+
"title": "Aktienkurs",
89+
"detail": {
90+
"text": "50,03 €",
91+
"trend": null,
92+
"action": null,
93+
"type": "text"
94+
},
95+
"style": "plain"
96+
},
97+
{
98+
"title": "Gebühr",
99+
"detail": {
100+
"text": "1,00 €",
101+
"trend": null,
102+
"action": null,
103+
"type": "text"
104+
},
105+
"style": "plain"
106+
},
107+
{
108+
"title": "Gesamt",
109+
"detail": {
110+
"text": "3.002,80 €",
111+
"trend": null,
112+
"action": null,
113+
"type": "text"
114+
},
115+
"style": "highlighted"
116+
}
117+
],
118+
"action": null,
119+
"type": "table"
120+
},
121+
{
122+
"title": "Dokumente",
123+
"data": [
124+
{
125+
"title": "Abrechnung",
126+
"detail": "20.02.2024",
127+
"action": {
128+
"type": "browserModal",
129+
"payload": ""
130+
},
131+
"id": "",
132+
"postboxType": "SECURITIES_SETTLEMENT",
133+
"local filepath": "20241021/Abrechnung/2024-02-20 Abrechnung - Euro Stoxx 50 EUR (Dist).pdf"
134+
},
135+
{
136+
"title": "Basisinformationsblatt",
137+
"detail": "20.02.2024",
138+
"action": {
139+
"type": "browserModal",
140+
"payload": ""
141+
},
142+
"id": "62c2529e",
143+
"postboxType": "INFO",
144+
"local filepath": "20241021/Basisinformationsblatt/2024-02-20 Basisinformationsblatt - Euro Stoxx 50 EUR (Dist).pdf"
145+
},
146+
{
147+
"title": "Kosteninformation",
148+
"detail": "20.02.2024",
149+
"action": {
150+
"type": "browserModal",
151+
"payload": ""
152+
},
153+
"id": "668b8e97",
154+
"postboxType": "COSTS_INFO_BUY_V2",
155+
"local filepath": "20241021/Kosteninformation/2024-02-20 Kosteninformation - Euro Stoxx 50 EUR (Dist).pdf"
156+
}
157+
],
158+
"action": null,
159+
"type": "documents"
160+
},
161+
{
162+
"title": "Hilfe",
163+
"data": [
164+
{
165+
"title": "Report a issue",
166+
"detail": {
167+
"icon": "logos/timeline_communication/v2",
168+
"action": {
169+
"type": "customerSupportChat",
170+
"payload": {
171+
"contextParams": {
172+
"chat_flow_key": "NHC_0029_wealth_buying_selling_past_trade_execution",
173+
"timelineEventId": "",
174+
"primId": ""
175+
},
176+
"contextCategory": "NHC"
177+
}
178+
},
179+
"style": "highlighted",
180+
"type": "listItemAvatarDefault"
181+
},
182+
"style": "plain"
183+
}
184+
],
185+
"action": null,
186+
"type": "table"
187+
}
188+
]
189+
},
190+
"has_docs": true
191+
}

tests/test_event_csv_formatter.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,23 @@ def test_event_csv_formatter():
1818
csv_output = formatter.format(event)
1919

2020
# Assert that the output is not an empty string
21-
assert csv_output != "2024-09-10;Einlage;3.000;Vorname Nachname;;;;\n"
21+
assert csv_output == "2024-09-10;Einlage;3.000;Vorname Nachname;;;;\n"
22+
23+
24+
25+
def test_buy():
26+
# Load the sample JSON file
27+
with open("tests/sample_buy.json", "r") as file:
28+
sample_data = json.load(file)
29+
30+
# Parse the JSON data using the from_dict function
31+
event = Event.from_dict(sample_data)
32+
33+
# Create an instance of EventCsvFormatter
34+
formatter = EventCsvFormatter(lang="de")
35+
36+
# Format the event to CSV
37+
csv_output = formatter.format(event)
38+
39+
# Assert that the output is not an empty string
40+
assert csv_output == "2024-02-20;Kauf;-3.002,8;Euro Stoxx 50 EUR (Dist);IE00B4K6B022;60;-1;\n"

0 commit comments

Comments
 (0)