Esempio n. 1
0
 def test_size_method_with_1_leader_and_2_trippees(self):
     trips_year = self.init_trips_year()
     trip = mommy.make(Trip, trips_year=trips_year)
     make_application(trips_year=trips_year, assigned_trip=trip)
     mommy.make(IncomingStudent, trips_year=trips_year, trip_assignment=trip)
     mommy.make(IncomingStudent, trips_year=trips_year, trip_assignment=trip)
     self.assertEqual(trip.size(), 3)
Esempio n. 2
0
 def test_does_not_get_half_foodbox(self):
     trips_year = self.init_trips_year()
     trip = mommy.make(
         Trip, trips_year=trips_year,
         template__triptype__half_kickin=3
     )
     make_application(trips_year=trips_year, assigned_trip=trip)
     mommy.make(IncomingStudent, trips_year=trips_year, trip_assignment=trip)
     self.assertFalse(trip.half_foodbox)
Esempio n. 3
0
 def test_does_not_get_half_foodbox(self):
     trips_year = self.init_trips_year()
     trip = mommy.make(Trip,
                       trips_year=trips_year,
                       template__triptype__half_kickin=3)
     make_application(trips_year=trips_year, trip_assignment=trip)
     mommy.make(IncomingStudent,
                trips_year=trips_year,
                trip_assignment=trip)
     self.assertFalse(trip.half_foodbox)
Esempio n. 4
0
 def test_size_method_with_1_leader_and_2_trippees(self):
     trips_year = self.init_trips_year()
     trip = mommy.make(Trip, trips_year=trips_year)
     make_application(trips_year=trips_year, trip_assignment=trip)
     mommy.make(IncomingStudent,
                trips_year=trips_year,
                trip_assignment=trip)
     mommy.make(IncomingStudent,
                trips_year=trips_year,
                trip_assignment=trip)
     self.assertEqual(trip.size, 3)
Esempio n. 5
0
 def test_trip_assignment_automatically_sets_LEADER_status(self):
     trips_year = self.init_trips_year()
     trip = mommy.make(Trip, trips_year=trips_year)
     volunteer = make_application(trips_year=trips_year)
     volunteer.leader_supplement.set_section_preference(trip.section, AVAILABLE)
     volunteer.leader_supplement.set_triptype_preference(trip.template.triptype, AVAILABLE)
     url = reverse('db:assign_leader', kwargs={'trips_year': trips_year.pk, 'trip_pk': trip.pk})
     res = self.app.get(url, user=self.mock_director())
     res = res.click(description="Assign to")
     res.form.submit()  # assign to trip - first (and only) form on page
     volunteer = GeneralApplication.objects.get(pk=volunteer.pk)  # refresh
     self.assertEqual(volunteer.assigned_trip, trip)
     self.assertEqual(volunteer.status, GeneralApplication.LEADER)
Esempio n. 6
0
 def test_assign_trip_computes_section_and_type_preferences(self):
     trips_year = self.init_trips_year()
     trip = mommy.make(Trip, trips_year=trips_year)
     volunteer = make_application(trips_year=trips_year)
     volunteer.leader_supplement.set_section_preference(trip.section, AVAILABLE)
     volunteer.leader_supplement.set_triptype_preference(trip.template.triptype, PREFER)
     url = reverse('db:assign_leader', kwargs={'trips_year': trips_year.pk, 'trip_pk': trip.pk})
     res = self.app.get(url, user=self.mock_director())
     leader_list = list(res.context['leader_applications'])
     self.assertEqual(len(leader_list), 1)
     (leader, _, triptype_preference, section_preference) = leader_list[0]
     self.assertEqual(leader, volunteer)
     self.assertEqual(triptype_preference, PREFER)
     self.assertEqual(section_preference, AVAILABLE)
Esempio n. 7
0
 def test_trip_assignment_automatically_sets_LEADER_status(self):
     trips_year = self.init_trips_year()
     trip = mommy.make(Trip, trips_year=trips_year)
     volunteer = make_application(trips_year=trips_year)
     volunteer.leader_supplement.set_section_preference(
         trip.section, AVAILABLE)
     volunteer.leader_supplement.set_triptype_preference(
         trip.template.triptype, AVAILABLE)
     url = reverse(
         'core:assign_leader',
         kwargs={
             'trips_year': trips_year.pk,
             'trip_pk': trip.pk
         },
     )
     res = self.app.get(url, user=self.make_director())
     res = res.click(description="Assign to")
     res.form.submit()  # assign to trip - first (and only) form on page
     volunteer = Volunteer.objects.get(pk=volunteer.pk)  # refresh
     self.assertEqual(volunteer.trip_assignment, trip)
     self.assertEqual(volunteer.status, Volunteer.LEADER)
Esempio n. 8
0
 def test_assign_trip_computes_section_and_type_preferences(self):
     trips_year = self.init_trips_year()
     trip = mommy.make(Trip, trips_year=trips_year)
     volunteer = make_application(trips_year=trips_year)
     volunteer.leader_supplement.set_section_preference(
         trip.section, AVAILABLE)
     volunteer.leader_supplement.set_triptype_preference(
         trip.template.triptype, PREFER)
     url = reverse(
         'core:assign_leader',
         kwargs={
             'trips_year': trips_year.pk,
             'trip_pk': trip.pk
         },
     )
     res = self.app.get(url, user=self.make_director())
     leader_list = list(res.context['leader_applications'])
     self.assertEqual(len(leader_list), 1)
     (leader, _, triptype_preference, section_preference) = leader_list[0]
     self.assertEqual(leader, volunteer)
     self.assertEqual(triptype_preference, PREFER)
     self.assertEqual(section_preference, AVAILABLE)
Esempio n. 9
0
 def test_size_method_with_1_leader(self):
     trips_year = self.init_trips_year()
     trip = mommy.make(Trip, trips_year=trips_year)
     make_application(trips_year=trips_year, trip_assignment=trip)
     self.assertEqual(trip.size, 1)
Esempio n. 10
0
 def test_size_method_with_1_leader(self):
     trips_year = self.init_trips_year()
     trip = mommy.make(Trip, trips_year=trips_year)
     make_application(trips_year=trips_year, assigned_trip=trip)
     self.assertEqual(trip.size(), 1)