-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fixed cron job and added tests - EVent Invoice Due Marking
- Loading branch information
1 parent
9ff0f83
commit 50b78ad
Showing
2 changed files
with
35 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import datetime | ||
|
||
from app import current_app as app, db | ||
from app.factories.event_invoice import EventInvoiceFactory | ||
from app.models.event_invoice import EventInvoice | ||
from app.api.helpers.scheduled_jobs import event_invoices_mark_due | ||
|
||
from tests.all.integration.utils import OpenEventTestCase | ||
|
||
|
||
class TestScheduledJobs(OpenEventTestCase): | ||
|
||
def test_event_invoices_mark_due(self): | ||
"""Method to test marking of event invoices as due""" | ||
|
||
with app.test_request_context(): | ||
event_invoice = EventInvoiceFactory(event__ends_at=datetime.datetime(2019, 7, 20)) | ||
db.session.commit() | ||
event_invoice_id = event_invoice.id | ||
event_invoices_mark_due() | ||
status = EventInvoice.query.get(event_invoice_id).status | ||
self.assertEqual(status, "due") | ||
|
||
event_invoice = EventInvoiceFactory(status="paid") | ||
db.session.commit() | ||
event_invoice_id = event_invoice.id | ||
event_invoices_mark_due() | ||
status = EventInvoice.query.get(event_invoice_id).status | ||
self.assertNotEqual(status, "due") |