def test_get_representative_user_attendance(self):
     campaign = CampaignRecipe.make()
     user_attendance = UserAttendanceRecipe.make(
         campaign=campaign,
         userprofile__user__first_name="Foo",
         userprofile__user__last_name="name",
         userprofile__telephone="123456789",
         userprofile__user__email="*****@*****.**",
     )
     subsidiary_box = mommy.make(
         'SubsidiaryBox',
         teampackage_set=[
             mommy.make(
                 'TeamPackage',
                 packagetransaction_set=mommy.make(
                     'PackageTransaction',
                     user_attendance=user_attendance,
                     _quantity=1,
                 ),
             ),
         ],
         delivery_batch__campaign=campaign,
     )
     self.assertEqual(
         subsidiary_box.get_representative_addressee(),
         {
             'name': "Foo name",
             'telephone': "123456789",
             'email': "*****@*****.**",
         },
     )
예제 #2
0
 def test_box_parameters_non_zero(self):
     campaign = CampaignRecipe.make(
         package_weight=0.5,
         package_width=0.5,
         package_height=0.5,
         package_depth=0.5,
         year=2018,
     )
     subsidiary_box = mommy.make(
         "SubsidiaryBox",
         teampackage_set=mommy.make(
             "TeamPackage",
             packagetransaction_set=mommy.make(
                 "PackageTransaction",
                 user_attendance=UserAttendanceRecipe.make(
                     campaign=campaign, ),
                 _quantity=2,
             ),
             _quantity=1,
         ),
         delivery_batch__campaign=campaign,
     )
     self.assertEqual(subsidiary_box.get_t_shirt_count(), 2)
     self.assertEqual(subsidiary_box.get_weight(), 1)
     self.assertEqual(subsidiary_box.get_volume(), 0.25)
예제 #3
0
    def setUp(self):
        campaign = CampaignRecipe.make(
            package_weight=0.5,
            package_width=0.5,
            package_height=0.5,
            package_depth=0.5,
            year=2018,
        )
        user_attendance = UserAttendanceRecipe.make(
            campaign=campaign,
            userprofile__user__username="******",
            userprofile__user__first_name="Testing",
            userprofile__user__email="*****@*****.**",
            userprofile__user__last_name="User ",
            userprofile__nickname="Nick",
            userprofile__telephone=123456789,
        )
        team = mommy.make(
            "dpnk.Team",
            campaign=campaign,
            name="Testin team",
        )

        self.delivery_batch = mommy.prepare(
            "DeliveryBatch",
            campaign=campaign,
        )
        self.delivery_batch.add_packages_on_save = False
        self.delivery_batch.save()
        self.subsidiary_box = mommy.make(
            "SubsidiaryBox",
            subsidiary__address_street="Foo street",
            subsidiary__address_psc=12234,
            subsidiary__address_street_number="123",
            subsidiary__address_city="Foo city",
            subsidiary__address_recipient="Foo recipient",
            subsidiary__id=123,
            subsidiary__company__name="Foo company",
            subsidiary__company__ico=1231321313,
            delivery_batch=self.delivery_batch,
            id=1603824,
        )
        mommy.make(
            "TeamPackage",
            box=self.subsidiary_box,
            team=team,
            packagetransaction_set=mommy.make(
                'PackageTransaction',
                user_attendance=user_attendance,
                _quantity=1,
            ),
        )
 def test_box_count_non_zero(self):
     """
     Test box_count() with nonzero boxes
     """
     campaign = CampaignRecipe.make(name="Testin campaign")
     delivery_batch = mommy.make(
         "DeliveryBatch",
         subsidiarybox_set=mommy.prepare(
             "SubsidiaryBox",
             _quantity=2,
         ),
         campaign=campaign,
     )
     self.assertEqual(delivery_batch.box_count(), 2)
 def test_get_representative_user_attendance_no_teampackage(self):
     campaign = CampaignRecipe.make()
     subsidiary_box = mommy.make(
         'SubsidiaryBox',
         delivery_batch__campaign=campaign,
     )
     self.assertEqual(
         subsidiary_box.get_representative_addressee(),
         {
             'name': "",
             'telephone': "",
             'email': "",
         },
     )
예제 #6
0
 def test_get_representative_user_attendance_no_teampackage(self):
     campaign = CampaignRecipe.make(year=2018)
     subsidiary_box = mommy.make(
         "SubsidiaryBox",
         delivery_batch__campaign=campaign,
     )
     self.assertEqual(
         subsidiary_box.get_representative_addressee(),
         {
             "name": "",
             "telephone": "",
             "email": "",
         },
     )
 def test_get_representative_user_attendance_subsidiary_addressee(self):
     campaign = CampaignRecipe.make()
     subsidiary_box = mommy.make(
         'SubsidiaryBox',
         subsidiary__box_addressee_name="Foo name",
         subsidiary__box_addressee_telephone="123456789",
         subsidiary__box_addressee_email="*****@*****.**",
         delivery_batch__campaign=campaign,
     )
     self.assertEqual(
         subsidiary_box.get_representative_addressee(),
         {
             'name': "Foo name",
             'telephone': "123456789",
             'email': "*****@*****.**",
         },
     )
예제 #8
0
 def test_get_representative_user_attendance_no_package_transaction(self):
     campaign = CampaignRecipe.make(year=2018)
     subsidiary_box = mommy.make(
         'SubsidiaryBox',
         teampackage_set=[
             mommy.make(
                 'TeamPackage',
             ),
         ],
         delivery_batch__campaign=campaign,
     )
     self.assertEqual(
         subsidiary_box.get_representative_addressee(),
         {
             'name': "",
             'telephone': "",
             'email': "",
         },
     )