1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from datetime import date, timedelta
6 from django.test import TestCase
7 from .models import Offer, Perk, Funding
10 class FundTest(TestCase):
12 self.today = date.today()
13 self.offer1 = Offer.objects.create(
14 author='author1', title='title1', slug='slug1',
15 target=100, start=self.today, end=self.today)
18 perk = Perk.objects.create(price=20, name='Perk 20')
19 perk1 = Perk.objects.create(offer=self.offer1, price=50, name='Perk 50')
20 offer2 = Offer.objects.create(
21 author='author2', title='title2', slug='slug2',
22 target=100, start=self.today-timedelta(1), end=self.today-timedelta(1))
23 perk2 = Perk.objects.create(offer=offer2, price=1, name='Perk 1')
26 set(self.offer1.get_perks(10)),
29 set(self.offer1.get_perks(70)),