Skip to content

Commit

Permalink
🧪 204 response
Browse files Browse the repository at this point in the history
  • Loading branch information
juftin committed Dec 17, 2023
1 parent 0c42f49 commit ac3cf5f
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
52 changes: 52 additions & 0 deletions tests/models/cassettes/test_204_response.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
interactions:
- request:
body: '{"transactions":[{"date":"2023-12-17","amount":3.5,"payee":"Test","notes":"Test Transaction Group"}],"apply_rules":false,"skip_duplicates":true,"check_for_recurring":false,"debit_as_negative":false,"skip_balance_update":true}'
headers:
accept:
- '*/*'
accept-encoding:
- gzip, deflate
authorization:
- XXXXXXXXXX
connection:
- keep-alive
content-length:
- '225'
content-type:
- application/json
host:
- dev.lunchmoney.app
user-agent:
- lunchable/1.0.1
method: POST
uri: https://dev.lunchmoney.app/v1/transactions
response:
content: ''
headers:
Access-Control-Allow-Credentials:
- 'true'
Connection:
- keep-alive
Content-Type:
- application/json; charset=utf-8
Date:
- Sun, 17 Dec 2023 15:58:07 GMT
Etag:
- W/"13-wFA9Dx4FmHqyjCvL9k0g9w+7+E0"
Nel:
- '{"report_to":"heroku-nel","max_age":3600,"success_fraction":0.005,"failure_fraction":0.05,"response_headers":["Via"]}'
Report-To:
- '{"group":"heroku-nel","max_age":3600,"endpoints":[{"url":"https://nel.heroku.com/reports?ts=1702828687&sid=1b10b0ff-8a76-4548-befa-353fc6c6c045&s=fEMUT%2FofMtfxWVkKFLbxjXEBTFvUTnApoF86q3Dt%2By8%3D"}]}'
Reporting-Endpoints:
- heroku-nel=https://nel.heroku.com/reports?ts=1702828687&sid=1b10b0ff-8a76-4548-befa-353fc6c6c045&s=fEMUT%2FofMtfxWVkKFLbxjXEBTFvUTnApoF86q3Dt%2By8%3D
Server:
- Cowboy
Vary:
- Origin, Accept-Encoding
Via:
- 1.1 vegur
X-Powered-By:
- Express
http_version: HTTP/1.1
status_code: 204
version: 1
17 changes: 17 additions & 0 deletions tests/models/test_transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,20 @@ def test_get_uncleared_transactions(lunch_money_obj: LunchMoney) -> None:
assert len(uncleared_transactions) >= 1
for transaction in uncleared_transactions:
assert isinstance(transaction, TransactionObject)


@lunchable_cassette
def test_204_response(lunch_money_obj: LunchMoney) -> None:
"""
Test that a 204 response is handled correctly
This test includes a hand-edited cassette to simulate a 204 response
"""
test_transaction = TransactionInsertObject(
date=datetime.date.today(),
payee="Test",
notes="Test Transaction Group",
amount=3.50,
)
response = lunch_money_obj.insert_transactions(transactions=test_transaction)
assert response == []

0 comments on commit ac3cf5f

Please sign in to comment.