Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: removes discrepancies in cancelling order
add test fix hound fix test
- Loading branch information
1 parent
0ed4363
commit 8ce2148
Showing
3 changed files
with
111 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import unittest | ||
from flask import Request, request, jsonify | ||
|
||
from app import current_app as app, db | ||
from app.api.helpers.db import save_to_db | ||
from app.factories.attendee import AttendeeFactory | ||
from app.factories.event import EventFactoryBasic | ||
from app.factories.order import OrderFactory | ||
from app.models.order import Order | ||
from app.api.helpers.db import save_to_db | ||
from tests.all.integration.setup_database import Setup | ||
|
||
|
||
class TestOrderUtilities(OpenEventTestCase): | ||
def setUp(self): | ||
self.app = Setup.create_app() | ||
|
||
def test_order_cancellation(self): | ||
"""Method to test order cancellation""" | ||
|
||
with app.test_request_context(): | ||
client = app.test_client() | ||
attendee = AttendeeFactory() | ||
save_to_db(attendee) | ||
|
||
obj = OrderFactory() | ||
obj.ticket_holders = [attendee, ] | ||
save_to_db(obj) | ||
data = { | ||
"data": { | ||
"attributes": { | ||
"status": "cancelled" | ||
}, | ||
"type": "order", | ||
"id": obj.id | ||
} | ||
} | ||
resp = client.patch('/v1/orders/1', data=dict( | ||
order=obj, | ||
data=data)) | ||
res = resp.get_json() | ||
self.assertEqual(res['status'], 'cancelled') | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |