def create_offer_year(acronym, title, academic_year): an_offer_year = offer_year.OfferYear(offer=test_offer.create_offer(title), academic_year=academic_year, acronym=acronym, title=title) an_offer_year.save() return an_offer_year
def setUp(self): #Teacher self.adviser_teacher = test_adviser.create_adviser_from_scratch( username='******', email='*****@*****.**', password='******', type='PRF') #Manager self.adviser_manager = test_adviser.create_adviser_from_scratch( username='******', email='*****@*****.**', password='******', type='MGR') #Proposition Offer offer = test_offer.create_offer(title="TEST_OFFER") self.offer_proposition = test_offer_proposition.create_offer_proposition( acronym="TEST_OFFER_NOW", offer=offer) # Create multiple propositions dissertations self.teacher_propositon_dissertations = [] self.manager_proposition_dissertations = [] for x in range(0, 5): # Teacher proposition dissertation creation teacher_prop = test_proposition_dissertation.create_proposition_dissertation( title="Teacher proposition " + str(x), adviser=self.adviser_teacher, person=self.adviser_teacher.person, offer_proposition=self.offer_proposition) self.teacher_propositon_dissertations.append(teacher_prop) # Manager proposition dissertation creation manager_prop = test_proposition_dissertation.create_proposition_dissertation( title="Manager propostion " + str(x), adviser=self.adviser_manager, person=self.adviser_manager.person, offer_proposition=self.offer_proposition) self.manager_proposition_dissertations.append(manager_prop)
def test_get_last_offer_year_by_offer(self): an_offer = test_offer.create_offer("test_offer") academic_years = [AcademicYearFactory(year=2015 + x) for x in range(3)] offer_years = [ OfferYearFactory( offer=an_offer, academic_year=academic_years[x], ) for x in range(3) ] self.assertEqual(offer_year.get_last_offer_year_by_offer(an_offer), offer_years[2])