Add some tests

This commit is contained in:
Raphael Michel
2019-10-18 13:08:25 +02:00
parent a1c7a6f2b0
commit f8433b5cc9
10 changed files with 555 additions and 15 deletions

View File

@@ -341,10 +341,10 @@ class GiftCardCreateForm(forms.ModelForm):
self.organizer = kwargs.pop('organizer')
super().__init__(*args, **kwargs)
def validate_secret(self):
def clean_secret(self):
s = self.cleaned_data['secret']
if GiftCard.objects.filter(
secret=s
secret__iexact=s
).filter(
Q(issuer=self.organizer) | Q(issuer__gift_card_collector_acceptance__collector=self.organizer)
).exists():