Skip to content

Commit

Permalink
Another test
Browse files Browse the repository at this point in the history
  • Loading branch information
Katzmann1983 committed Oct 21, 2024
1 parent aeb4a45 commit 3280e88
Show file tree
Hide file tree
Showing 3 changed files with 212 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pytr/dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def dl_doc(self, doc, titleText, subtitleText, subfolder=None):
return
else:
filepath = filepath_with_doc_id
doc["local filepath"] = str(filepath)
doc["local_filepath"] = str(filepath)
self.filepaths.append(filepath)

if filepath.is_file() is False:
Expand Down
191 changes: 191 additions & 0 deletions tests/sample_buy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
{
"id": "12345678",
"timestamp": "2024-02-20T16:32:07.731+0000",
"title": "Euro Stoxx 50 EUR (Dist)",
"icon": "logos/IE00B4K6B022/v2",
"badge": null,
"subtitle": "Kauforder",
"amount": {
"currency": "EUR",
"value": -3002.8,
"fractionDigits": 2
},
"subAmount": null,
"status": "EXECUTED",
"action": {
"type": "timelineDetail",
"payload": "12345678"
},
"eventType": "ORDER_EXECUTED",
"source": "timelineTransaction",
"details": {
"id": "12345678",
"sections": [
{
"title": "Du hast 3.002,80 € investiert",
"data": {
"icon": "logos/IE00B4K6B022/v2",
"subtitleText": null,
"timestamp": "2024-02-20T16:32:07.731+0000",
"status": "executed"
},
"action": {
"type": "instrumentDetail",
"payload": "IE00B4K6B022"
},
"type": "header"
},
{
"title": "Übersicht",
"data": [
{
"title": "Status",
"detail": {
"text": "Ausgeführt",
"functionalStyle": "EXECUTED",
"type": "status"
},
"style": "plain"
},
{
"title": "Orderart",
"detail": {
"text": "Kauf",
"trend": null,
"action": null,
"type": "text"
},
"style": "plain"
},
{
"title": "Asset",
"detail": {
"text": "Euro Stoxx 50 EUR (Dist)",
"trend": null,
"action": null,
"type": "text"
},
"style": "plain"
}
],
"action": null,
"type": "table"
},
{
"title": "Transaktion",
"data": [
{
"title": "Anteile",
"detail": {
"text": "60",
"trend": null,
"action": null,
"type": "text"
},
"style": "plain"
},
{
"title": "Aktienkurs",
"detail": {
"text": "50,03 €",
"trend": null,
"action": null,
"type": "text"
},
"style": "plain"
},
{
"title": "Gebühr",
"detail": {
"text": "1,00 €",
"trend": null,
"action": null,
"type": "text"
},
"style": "plain"
},
{
"title": "Gesamt",
"detail": {
"text": "3.002,80 €",
"trend": null,
"action": null,
"type": "text"
},
"style": "highlighted"
}
],
"action": null,
"type": "table"
},
{
"title": "Dokumente",
"data": [
{
"title": "Abrechnung",
"detail": "20.02.2024",
"action": {
"type": "browserModal",
"payload": ""
},
"id": "",
"postboxType": "SECURITIES_SETTLEMENT",
"local filepath": "20241021/Abrechnung/2024-02-20 Abrechnung - Euro Stoxx 50 EUR (Dist).pdf"
},
{
"title": "Basisinformationsblatt",
"detail": "20.02.2024",
"action": {
"type": "browserModal",
"payload": ""
},
"id": "62c2529e",
"postboxType": "INFO",
"local filepath": "20241021/Basisinformationsblatt/2024-02-20 Basisinformationsblatt - Euro Stoxx 50 EUR (Dist).pdf"
},
{
"title": "Kosteninformation",
"detail": "20.02.2024",
"action": {
"type": "browserModal",
"payload": ""
},
"id": "668b8e97",
"postboxType": "COSTS_INFO_BUY_V2",
"local filepath": "20241021/Kosteninformation/2024-02-20 Kosteninformation - Euro Stoxx 50 EUR (Dist).pdf"
}
],
"action": null,
"type": "documents"
},
{
"title": "Hilfe",
"data": [
{
"title": "Report a issue",
"detail": {
"icon": "logos/timeline_communication/v2",
"action": {
"type": "customerSupportChat",
"payload": {
"contextParams": {
"chat_flow_key": "NHC_0029_wealth_buying_selling_past_trade_execution",
"timelineEventId": "",
"primId": ""
},
"contextCategory": "NHC"
}
},
"style": "highlighted",
"type": "listItemAvatarDefault"
},
"style": "plain"
}
],
"action": null,
"type": "table"
}
]
},
"has_docs": true
}
21 changes: 20 additions & 1 deletion tests/test_event_csv_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,23 @@ def test_event_csv_formatter():
csv_output = formatter.format(event)

# Assert that the output is not an empty string
assert csv_output != "2024-09-10;Einlage;3.000;Vorname Nachname;;;;\n"
assert csv_output == "2024-09-10;Einlage;3.000;Vorname Nachname;;;;\n"



def test_buy():
# Load the sample JSON file
with open("tests/sample_buy.json", "r") as file:
sample_data = json.load(file)

# Parse the JSON data using the from_dict function
event = Event.from_dict(sample_data)

# Create an instance of EventCsvFormatter
formatter = EventCsvFormatter(lang="de")

# Format the event to CSV
csv_output = formatter.format(event)

# Assert that the output is not an empty string
assert csv_output == "2024-02-20;Kauf;-3.002,8;Euro Stoxx 50 EUR (Dist);IE00B4K6B022;60;-1;\n"

0 comments on commit 3280e88

Please sign in to comment.