flake8 fixes
This commit is contained in:
parent
a2fa1d6548
commit
4cdbdb71ce
6 changed files with 20 additions and 16 deletions
|
@ -10,6 +10,7 @@ register = template.Library()
|
||||||
|
|
||||||
_ProductAndQuantity = namedtuple("ProductAndQuantity", ["product", "quantity"])
|
_ProductAndQuantity = namedtuple("ProductAndQuantity", ["product", "quantity"])
|
||||||
|
|
||||||
|
|
||||||
class ProductAndQuantity(_ProductAndQuantity):
|
class ProductAndQuantity(_ProductAndQuantity):
|
||||||
''' Class that holds a product and a quantity.
|
''' Class that holds a product and a quantity.
|
||||||
|
|
||||||
|
|
|
@ -26,12 +26,16 @@ class RegistrationCartTestCase(SetTimeMixin, TestCase):
|
||||||
super(RegistrationCartTestCase, self).setUp()
|
super(RegistrationCartTestCase, self).setUp()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
if False:
|
if True:
|
||||||
# If you're seeing segfaults in tests, enable this.
|
# If you're seeing segfaults in tests, enable this.
|
||||||
call_command('flush', verbosity=0, interactive=False,
|
call_command(
|
||||||
|
'flush',
|
||||||
|
verbosity=0,
|
||||||
|
interactive=False,
|
||||||
reset_sequences=False,
|
reset_sequences=False,
|
||||||
allow_cascade=False,
|
allow_cascade=False,
|
||||||
inhibit_post_migrate=False)
|
inhibit_post_migrate=False
|
||||||
|
)
|
||||||
|
|
||||||
super(RegistrationCartTestCase, self).tearDown()
|
super(RegistrationCartTestCase, self).tearDown()
|
||||||
|
|
||||||
|
@ -51,11 +55,11 @@ class RegistrationCartTestCase(SetTimeMixin, TestCase):
|
||||||
password='top_secret')
|
password='top_secret')
|
||||||
|
|
||||||
attendee1 = people.Attendee.get_instance(cls.USER_1)
|
attendee1 = people.Attendee.get_instance(cls.USER_1)
|
||||||
profile1 = people.AttendeeProfileBase.objects.create(
|
people.AttendeeProfileBase.objects.create(
|
||||||
attendee=attendee1,
|
attendee=attendee1,
|
||||||
)
|
)
|
||||||
attendee2 = people.Attendee.get_instance(cls.USER_2)
|
attendee2 = people.Attendee.get_instance(cls.USER_2)
|
||||||
profile2 = people.AttendeeProfileBase.objects.create(
|
people.AttendeeProfileBase.objects.create(
|
||||||
attendee=attendee2,
|
attendee=attendee2,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -484,7 +484,7 @@ class InvoiceTestCase(RegistrationCartTestCase):
|
||||||
invoice.pay("Paying into the void.", cnval, pre_validate=False)
|
invoice.pay("Paying into the void.", cnval, pre_validate=False)
|
||||||
|
|
||||||
notes = commerce.CreditNote.objects.filter(invoice=invoice.invoice)
|
notes = commerce.CreditNote.objects.filter(invoice=invoice.invoice)
|
||||||
notes = sorted(notes, key = lambda note: note.value)
|
notes = sorted(notes, key=lambda note: note.value)
|
||||||
|
|
||||||
self.assertEqual(cnval, notes[0].value)
|
self.assertEqual(cnval, notes[0].value)
|
||||||
self.assertEqual(val, notes[1].value)
|
self.assertEqual(val, notes[1].value)
|
||||||
|
|
|
@ -21,7 +21,6 @@ from django.contrib import messages
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
from django.shortcuts import get_object_or_404
|
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
@ -569,7 +568,6 @@ def invoice_access(request, access_code):
|
||||||
user__attendee__access_code=access_code,
|
user__attendee__access_code=access_code,
|
||||||
).order_by("-issue_time")
|
).order_by("-issue_time")
|
||||||
|
|
||||||
|
|
||||||
if not invoices:
|
if not invoices:
|
||||||
raise Http404()
|
raise Http404()
|
||||||
|
|
||||||
|
@ -635,6 +633,7 @@ def _staff_only(user):
|
||||||
''' Returns true if the user is staff. '''
|
''' Returns true if the user is staff. '''
|
||||||
return user.is_staff
|
return user.is_staff
|
||||||
|
|
||||||
|
|
||||||
@user_passes_test(_staff_only)
|
@user_passes_test(_staff_only)
|
||||||
def manual_payment(request, invoice_id):
|
def manual_payment(request, invoice_id):
|
||||||
''' Allows staff to make manual payments or refunds on an invoice.
|
''' Allows staff to make manual payments or refunds on an invoice.
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
[flake8]
|
[flake8]
|
||||||
exclude = registrasion/migrations/*, build/*
|
exclude = registrasion/migrations/*, build/*, docs/*
|
||||||
|
|
Loading…
Reference in a new issue