forked from django-oscar/django-oscar
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix validation error in dashboard voucher form
The clean method was raising a KeyError when the date fields were empty.
- Loading branch information
1 parent
fd256b6
commit 02b3644
Showing
4 changed files
with
27 additions
and
6 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,22 @@ | ||
from django import test | ||
|
||
from oscar.apps.dashboard.vouchers import forms | ||
|
||
|
||
class TestVoucherForm(test.TestCase): | ||
|
||
def test_handles_empty_date_fields(self): | ||
data = {'code': '', | ||
'name': '', | ||
'start_date': '', | ||
'end_date': '', | ||
'benefit_range': '', | ||
'benefit_type': 'Percentage', | ||
'usage': 'Single use'} | ||
form = forms.VoucherForm(data=data) | ||
try: | ||
form.is_valid() | ||
except Exception, e: | ||
import traceback | ||
self.fail("Validating form failed: %s\n\n%s" % ( | ||
e.message, traceback.format_exc())) |
Empty file.
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