Ejemplo n.º 1
0
    def test_calculate_fundraiser_count(self):
        """ Test the counter for the number of fundraisers a user is owner of """
        self.assertEqual(self.user.fundraiser_count, 0)

        FundraiserFactory.create(amount=4000, owner=self.user)
        self.assertEqual(self.user.fundraiser_count, 1)
        FundraiserFactory.create(amount=4000, owner=self.user)
        self.assertEqual(self.user.fundraiser_count, 2)
Ejemplo n.º 2
0
    def test_calculate_fundraiser_count(self):
        """ Test the counter for the number of fundraisers a user is owner of """
        self.assertEqual(self.user.fundraiser_count, 0)

        FundraiserFactory.create(amount=4000, owner=self.user)
        self.assertEqual(self.user.fundraiser_count, 1)
        FundraiserFactory.create(amount=4000, owner=self.user)
        self.assertEqual(self.user.fundraiser_count, 2)
Ejemplo n.º 3
0
    def setUp(self):
        super(TestDonationList, self).setUp()

        self.init_projects()

        # Make user 1 a staff user
        self.user1.is_staff = True
        self.user1.save()

        # Create a target project/fundraiser
        self.project = ProjectFactory.create(amount_asked=5000, owner=self.user1)
        self.project.set_status('campaign')

        self.fundraiser = FundraiserFactory.create(amount=4000, owner=self.user1,
            project=self.project)

        # Two users make a donations
        order1 = OrderFactory.create(user=self.user1)
        self.donation1 = DonationFactory.create(amount=15, project=self.project, 
            fundraiser=self.fundraiser, order=order1)
        order1.locked()
        order1.succeeded()

        # Create the second without fundraiser
        order2 = OrderFactory.create(user=self.user2)
        self.donation2 = DonationFactory.create(amount=10, 
            project=self.project, fundraiser=None, order=order2)
        order2.locked()
        order2.succeeded()

        self.fundraiser_donation_list_url = reverse('fund-ticker-list')
Ejemplo n.º 4
0
    def test_create_single_donation(self, check_status_psp):
        """
        Test donation in the current donation flow where we have just one donation that can't be deleted.
        """

        # Create an order
        response = self.client.post(self.manage_order_list_url, {},
                                    token=self.user1_token)
        order_id = response.data['id']

        fundraiser = FundraiserFactory.create(amount=100)

        donation1 = {
            "fundraiser": fundraiser.pk,
            "project": fundraiser.project.slug,
            "order": order_id,
            "amount": 50
        }

        response = self.client.post(self.manage_donation_list_url,
                                    donation1,
                                    token=self.user1_token)
        self.assertEqual(response.status_code, status.HTTP_201_CREATED)
        self.assertEqual(response.data['status'], 'created')

        # Check that the order total is equal to the donation amount
        order_url = "{0}{1}".format(self.manage_order_list_url, order_id)
        response = self.client.get(order_url, token=self.user1_token)
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertEqual(response.data['total']['amount'], 50.00)
        self.assertEqual(response.data['total']['currency'], 'EUR')
        self.assertEqual(response.data['donations'][0]['name'], None)
Ejemplo n.º 5
0
    def test_create_single_donation(self, check_status_psp):
        """
        Test donation in the current donation flow where we have just one donation that can't be deleted.
        """

        # Create an order
        response = self.client.post(self.manage_order_list_url, {}, HTTP_AUTHORIZATION=self.user1_token)
        order_id = response.data['id']

        fundraiser = FundraiserFactory.create(amount=100)

        donation1 = {
            "fundraiser": fundraiser.pk,
            "project": fundraiser.project.slug,
            "order": order_id,
            "amount": 50
        }

        response = self.client.post(self.manage_donation_list_url, donation1, HTTP_AUTHORIZATION=self.user1_token)
        self.assertEqual(response.status_code, status.HTTP_201_CREATED)
        self.assertEqual(response.data['status'], 'created')
        donation_id = response.data['id']

        # Check that the order total is equal to the donation amount
        order_url = "{0}{1}".format(self.manage_order_list_url, order_id)
        response = self.client.get(order_url, HTTP_AUTHORIZATION=self.user1_token)
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertEqual(response.data['total'], 50)
Ejemplo n.º 6
0
    def setUp(self):
        super(TestFundraiserAmountDonated, self).setUp()

        self.init_projects()

        campaign = ProjectPhase.objects.get(slug="campaign")
        project = ProjectFactory.create(status=campaign)
        self.fundraiser = FundraiserFactory(project=project, amount=Money(1000, 'EUR'))
Ejemplo n.º 7
0
 def test_fundraiser_textwallpost_admin(self):
     fundraiser = FundraiserFactory()
     self.wallpost = MediaWallpostFactory.create(content_object=fundraiser)
     url = reverse('admin:wallposts_mediawallpost_change',
                   args=(self.wallpost.id, ))
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200, response.content)
     self.assertContains(response, fundraiser.title)
Ejemplo n.º 8
0
    def test_create_follow_create_fundraiser(self):
        """ Test that a Fundraiser also becomes a follower of a project """
        self.assertEqual(Follow.objects.count(), 0)

        fundraiser_person = BlueBottleUserFactory.create()
        FundraiserFactory(project=self.project, owner=fundraiser_person)

        self.assertEqual(Follow.objects.count(), 1)
        self.assertEqual(Follow.objects.all()[0].followed_object, self.project)
        self.assertEqual(Follow.objects.all()[0].user, fundraiser_person)
Ejemplo n.º 9
0
    def test_wallpost_mail_fundraiser(self):
        """ Test that the relevant people get an email when the email_followers option is selected for a fundraiser """

        # On a Fundraiser page, people who posted to the wall and who donated get an email --> Followers
        self.assertEqual(Follow.objects.count(), 0)

        # A user creates a fundraiser
        fundraiser_person = BlueBottleUserFactory.create()
        fundraiser = FundraiserFactory(project=self.project,
                                       owner=fundraiser_person)

        # Two people donate to the fundraiser
        donator1 = BlueBottleUserFactory.create()
        order = OrderFactory.create(user=donator1,
                                    status=StatusDefinition.CREATED)
        DonationFactory(order=order, amount=35,
                        project=self.project,
                        fundraiser=fundraiser)
        order.locked()
        order.success()
        order.save()

        donator2 = BlueBottleUserFactory.create()
        order2 = OrderFactory.create(user=donator2,
                                     status=StatusDefinition.CREATED)
        DonationFactory(order=order2, amount=35,
                        project=self.project,
                        fundraiser=fundraiser)

        order2.locked()
        order2.success()
        order2.save()

        # The fundraiser owner creates a wallpost to followers
        TextWallpostFactory.create(content_object=fundraiser,
                                   author=fundraiser_person,
                                   text="test_fundraiser",
                                   email_followers=True)

        mail_count = 0
        self.assertEqual(Follow.objects.count(), 3)

        # When the fundraiser sends an email to the followers he doesn't get one himself
        receivers = [donator1.email, donator2.email]

        for email in mail.outbox:
            if "New wallpost on" in email.subject:
                mail_count += 1
                self.assertTrue(email.to[0] in receivers)
                receivers.remove(email.to[0])

        self.assertEqual(mail_count, 2)
        self.assertEqual(receivers, [])
Ejemplo n.º 10
0
    def setUp(self):
        super(TestDonationEmails, self).setUp()
        self.init_projects()

        self.user = BlueBottleUserFactory.create(first_name='user')

        self.project_owner = BlueBottleUserFactory.create(
            first_name='projectowner')
        campaign_status = ProjectPhase.objects.get(slug='campaign')
        self.some_project = ProjectFactory.create(owner=self.project_owner,
                                                  status=campaign_status)

        self.order = OrderFactory.create(
            user=self.user,
        )

        self.recurring_order = OrderFactory.create(
            user=self.user,
            order_type="recurring"
        )

        self.donation = DonationFactory.create(
            order=self.order,
            project=self.some_project,
            fundraiser=None
        )

        self.recurring_donation = DonationFactory.create(
            order=self.recurring_order,
            project=self.some_project,
            fundraiser=None
        )

        self.fund_order = OrderFactory.create(
            user=self.user,
        )

        self.fund_project = ProjectFactory.create(owner=self.project_owner,
                                                  status=campaign_status)

        self.fund_owner = BlueBottleUserFactory.create(first_name='fundraiser')

        self.fundraiser_project = FundraiserFactory.create(
            owner=self.fund_owner,
            project=self.fund_project,
        )

        self.fund_donation = DonationFactory.create(
            order=self.fund_order,
            project=self.fund_project,
            fundraiser=self.fundraiser_project
        )
Ejemplo n.º 11
0
    def test_no_mail_no_campaign_notifications(self):
        """
        Test that users who have campaign_notifications turned off don't get email
        """
        task_owner1 = BlueBottleUserFactory.create(campaign_notifications=False)

        TaskFactory.create(
            author=task_owner1,
            project=self.project
        )

        # Add extra project and owner that should not get any email
        project_owner = BlueBottleUserFactory.create(campaign_notifications=False)
        ProjectFactory(owner=project_owner, status=self.phase1)

        # Create a follower by donating
        donator1 = BlueBottleUserFactory.create(campaign_notifications=False)
        order = OrderFactory.create(user=donator1,
                                    status=StatusDefinition.CREATED)
        DonationFactory(order=order, amount=35,
                        project=self.project,
                        fundraiser=None)
        order.locked()
        order.success()
        order.save()

        # Create a follower by being a fundraiser for the project
        fundraiser_person = BlueBottleUserFactory.create(campaign_notifications=False)
        FundraiserFactory(project=self.project,
                          owner=fundraiser_person)

        self.assertEqual(Follow.objects.count(), 3)

        # Create follower by voting
        voter_person = BlueBottleUserFactory.create(
            campaign_notifications=False)
        VoteFactory(voter=voter_person, project=self.project)

        # Project owner creates a wallpost and emails followers
        TextWallpostFactory.create(
            content_object=self.project, author=self.project.owner,
            text="test2", email_followers=True)

        mail_count = 0

        # People who should get an email: self.some_user, task_owner1,
        # fundraiser_person, commenter, voter and donator1
        for email in mail.outbox:
            if "New wallpost on" in email.subject:
                mail_count += 1
        self.assertEqual(mail_count, 0)
Ejemplo n.º 12
0
    def setUp(self):
        super(TestMyFundraiserDonationList, self).setUp()

        self.project4 = ProjectFactory.create(amount_asked=5000, owner=self.user1)
        self.project4.set_status('campaign')
        self.fundraiser = FundraiserFactory.create(amount=4000, owner=self.user1, project=self.project4)

        # User 2 makes a donation
        order = OrderFactory.create(user=self.user2)
        donation = DonationFactory.create(amount=1000, project=self.project4, fundraiser=self.fundraiser, order=order)

        order.locked()
        order.succeeded()

        self.fundraiser_donation_list_url = reverse('my-fundraiser-donation-list')
Ejemplo n.º 13
0
    def setUp(self):
        super(TestDonationEmails, self).setUp()
        self.init_projects()

        self.user = BlueBottleUserFactory.create(first_name='user',
                                                 last_name='userson')
        self.user.address.line1 = "'s Gravenhekje 1A"
        self.user.address.city = "Mokum A"
        self.user.save()

        self.project_owner = BlueBottleUserFactory.create(
            first_name='projectowner')
        campaign_status = ProjectPhase.objects.get(slug='campaign')
        self.some_project = ProjectFactory.create(owner=self.project_owner,
                                                  status=campaign_status)

        self.order = OrderFactory.create(user=self.user, )

        self.recurring_order = OrderFactory.create(user=self.user,
                                                   order_type="recurring")

        self.donation = DonationFactory.create(order=self.order,
                                               project=self.some_project,
                                               fundraiser=None)

        self.recurring_donation = DonationFactory.create(
            order=self.recurring_order,
            project=self.some_project,
            fundraiser=None)

        self.fund_order = OrderFactory.create(user=self.user, )

        self.fund_project = ProjectFactory.create(owner=self.project_owner,
                                                  status=campaign_status)

        self.fund_owner = BlueBottleUserFactory.create(first_name='fundraiser')

        self.fundraiser_project = FundraiserFactory.create(
            owner=self.fund_owner,
            project=self.fund_project,
        )

        self.fund_donation = DonationFactory.create(
            order=self.fund_order,
            project=self.fund_project,
            fundraiser=self.fundraiser_project)
Ejemplo n.º 14
0
    def setUp(self):
        super(TestDonationEmails, self).setUp()
        self.user = BlueBottleUserFactory.create(first_name='user')

        self.project_owner = BlueBottleUserFactory.create(first_name='projectowner')
        self.some_project = ProjectFactory.create(owner=self.project_owner)

        self.order = OrderFactory.create(
            user=self.user,
        )

        self.recurring_order = OrderFactory.create(
            user=self.user,
            order_type="recurring"
        )

        self.donation = DonationFactory.create(
            order=self.order,
            project=self.some_project,
            fundraiser=None
        )

        self.recurring_donation = DonationFactory.create(
            order=self.recurring_order,
            project=self.some_project,
            fundraiser=None
        )

        self.fund_order = OrderFactory.create(
            user=self.user,
        )

        self.fund_project = ProjectFactory.create(owner=self.project_owner)

        self.fund_owner = BlueBottleUserFactory.create(first_name='fundraiser')

        self.fundraiser_project = FundraiserFactory.create(
            owner=self.fund_owner,
            project=self.fund_project,
        )

        self.fund_donation = DonationFactory.create(
            order=self.fund_order,
            project=self.fund_project,
            fundraiser=self.fundraiser_project
        )
Ejemplo n.º 15
0
    def setUp(self):
        super(WallpostPermissionsTest, self).setUp()

        self.init_projects()

        self.owner = BlueBottleUserFactory.create(
            password='******', first_name='someName', last_name='someLast')
        self.owner_token = "JWT {0}".format(self.owner.get_jwt_token())

        self.project = ProjectFactory.create(owner=self.owner)
        self.fundraiser = FundraiserFactory.create(owner=self.owner)
        self.task = TaskFactory.create(author=self.owner)

        self.other_user = BlueBottleUserFactory.create()
        self.other_token = "JWT {0}".format(
            self.other_user.get_jwt_token())

        self.media_wallpost_url = reverse('media_wallpost_list')
Ejemplo n.º 16
0
    def test_create_donations_with_names(self, check_status_psp):
        """
        Test donation with specifying a custom donor name.
        """

        # Create an order
        response = self.client.post(self.manage_order_list_url, {},
                                    token=self.user1_token)
        order_id = response.data['id']

        fundraiser = FundraiserFactory.create(amount=100)

        donation1 = {
            "fundraiser": fundraiser.pk,
            "project": fundraiser.project.slug,
            "order": order_id,
            "name": 'Tante Sjaan',
            "amount": 7.5
        }
        donation2 = {
            "fundraiser": fundraiser.pk,
            "project": fundraiser.project.slug,
            "order": order_id,
            "name": 'Ome Piet',
            "amount": 12.5
        }

        response = self.client.post(self.manage_donation_list_url,
                                    donation1,
                                    token=self.user1_token)
        self.assertEqual(response.status_code, status.HTTP_201_CREATED)
        response = self.client.post(self.manage_donation_list_url,
                                    donation2,
                                    token=self.user1_token)
        self.assertEqual(response.status_code, status.HTTP_201_CREATED)

        # Check that the order total is equal to the donation amount
        order_url = "{0}{1}".format(self.manage_order_list_url, order_id)
        response = self.client.get(order_url, token=self.user1_token)
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertEqual(response.data['total']['amount'], 20.00)
        self.assertEqual(response.data['total']['currency'], 'EUR')
        self.assertEqual(response.data['donations'][1]['name'], 'Tante Sjaan')
        self.assertEqual(response.data['donations'][0]['name'], 'Ome Piet')
Ejemplo n.º 17
0
    def setUp(self):
        super(WallpostPermissionsTest, self).setUp()

        self.init_projects()

        self.owner = BlueBottleUserFactory.create(password='******',
                                                  first_name='someName',
                                                  last_name='someLast')
        self.owner_token = "JWT {0}".format(self.owner.get_jwt_token())

        self.project = ProjectFactory.create(owner=self.owner)
        self.fundraiser = FundraiserFactory.create(owner=self.owner)
        self.task = TaskFactory.create(author=self.owner)

        self.other_user = BlueBottleUserFactory.create()
        self.other_token = "JWT {0}".format(self.other_user.get_jwt_token())

        self.media_wallpost_url = reverse('media_wallpost_list')
        self.text_wallpost_url = reverse('text_wallpost_list')
        self.wallpost_url = reverse('wallpost_list')
Ejemplo n.º 18
0
    def test_successfull_fundraiser_donation(self):
        """
        Test that a SystemWallpost is created for the fundraiser
        wall only when a user does a succesful donation
        """
        self.assertEqual(SystemWallpost.objects.count(), 0)

        order = OrderFactory.create(user=self.user1)
        fundraiser = FundraiserFactory(project=self.project1)
        DonationFactory(order=order, amount=35,
                        project=self.project1, fundraiser=fundraiser)

        order.locked()
        order.save()
        order.success()
        order.save()

        self.assertEqual(SystemWallpost.objects.count(), 1)
        self.assertEqual(SystemWallpost.objects.all()[0].content_object,
                         fundraiser)
        self.assertEqual(SystemWallpost.objects.all()[0].author, order.user)
        self.assertEqual(len(mail.outbox), 3)
Ejemplo n.º 19
0
    def setUp(self):
        super(TestMyFundraiserDonationList, self).setUp()

        self.project4 = ProjectFactory.create(amount_asked=5000,
                                              owner=self.user1)
        self.project4.set_status('campaign')
        self.fundraiser = FundraiserFactory.create(amount=4000,
                                                   owner=self.user1,
                                                   project=self.project4)

        # User 2 makes a donation
        order = OrderFactory.create(user=self.user2)
        DonationFactory.create(amount=1000,
                               project=self.project4,
                               fundraiser=self.fundraiser,
                               order=order)

        order.locked()
        order.save()
        order.success()
        order.save()

        self.fundraiser_donation_list_url = reverse(
            'my-fundraiser-donation-list')
Ejemplo n.º 20
0
    def setUp(self):
        super(TestEngagementMetricsXls, self).setUp()
        self.init_projects()

        self.year = datetime.now().year

        # Project Phases
        done_complete = ProjectPhase.objects.get(slug="done-complete")
        done_incomplete = ProjectPhase.objects.get(slug="done-incomplete")

        # Users
        user1 = BlueBottleUserFactory.create()

        # Projects
        project1 = ProjectFactory.create(owner=user1, status=done_complete)
        ProjectFactory.create(owner=user1, status=done_incomplete)

        # Wallposts
        TextWallpostFactory.create(content_object=project1,
                                   author=user1,
                                   editor=user1,
                                   text="test1",
                                   email_followers=False)

        # Votes
        VoteFactory(project=project1, voter=user1)

        # Fundraisers
        fundraiser = FundraiserFactory(project=project1, owner=user1)

        # Donations
        order1 = OrderFactory.create(user=user1)
        DonationFactory(order=order1, fundraiser=fundraiser, project=project1)
        order1.locked()
        order1.save()
        order1.success()
        order1.save()

        order2 = OrderFactory.create(user=None)
        donation2 = DonationFactory(order=order2,
                                    fundraiser=fundraiser,
                                    project=project1)
        donation2.anonymous = True
        order2.locked()
        order2.save()
        order2.success()
        order2.save()

        # Tasks
        task = TaskFactory.create(author=user1,
                                  project=project1,
                                  people_needed=2,
                                  status='realized')
        task_member = TaskMemberFactory.create(
            time_spent=10,
            member=user1,
            task=task,
            status=TaskMember.TaskMemberStatuses.applied)
        task_member.status = TaskMember.TaskMemberStatuses.realized
        task_member.save()

        # Simulate user Login
        jwt_token = user1.get_jwt_token()
        task_member_url = reverse('task-member-detail',
                                  kwargs={'pk': task_member.id})
        self.client.get(task_member_url, token="JWT {0}".format(jwt_token))

        # xls export
        self.xls_file_name = 'test.xlsx'
        self.xls_file_path = os.path.join(settings.PROJECT_ROOT,
                                          self.xls_file_name)
        self.command = EngagementCommand()
Ejemplo n.º 21
0
    def test_wallpost_mail_project(self):
        """
        Test that the relevant people get an email when the
        email_followers option is selected for a project
        """

        # On a project page, task owners, fundraisers, and people who donated,  get a mail.

        # Create a follower by being a task owner
        task_owner1 = BlueBottleUserFactory.create()

        TaskFactory.create(
            author=task_owner1,
            project=self.project
        )

        # Add extra project and owner that should not get any email
        project_owner = BlueBottleUserFactory.create()
        ProjectFactory(owner=project_owner, status=self.phase1)

        # iLeaving a wallpost should not create a follower
        commenter = BlueBottleUserFactory.create()
        TextWallpostFactory.create(content_object=self.project,
                                   author=commenter,
                                   text="test1",
                                   email_followers=False)

        # Create a follower by donating
        donator1 = BlueBottleUserFactory.create()
        order = OrderFactory.create(user=donator1,
                                    status=StatusDefinition.CREATED)
        DonationFactory(order=order, amount=35,
                        project=self.project,
                        fundraiser=None)
        order.locked()
        order.success()
        order.save()

        # Create a follower by being a fundraiser for the project
        fundraiser_person = BlueBottleUserFactory.create()
        FundraiserFactory(project=self.project, owner=fundraiser_person)

        self.assertEqual(Follow.objects.count(), 3)

        voter = BlueBottleUserFactory.create()
        VoteFactory(voter=voter, project=self.project)

        self.assertEqual(Follow.objects.count(), 4)

        # Project owner creates a wallpost and emails followers
        TextWallpostFactory.create(
            content_object=self.project, author=self.project.owner,
            text="test2", email_followers=True)

        mail_count = 0

        # People who should get an email: self.some_user, voter, task_owner1,
        # fundraiser_person, commenter, and donator1
        receivers = [voter.email, task_owner1.email, fundraiser_person.email, donator1.email]
        for email in mail.outbox:
            if "New wallpost on" in email.subject:
                mail_count += 1
                self.assertTrue(email.to[0] in receivers)
                receivers.remove(email.to[0])
        self.assertEqual(mail_count, 4)
        self.assertEqual(receivers, [])
Ejemplo n.º 22
0
    def test_wallpost_delete_mail_project(self):
        """
        Test that the relevant people don't get an email when the
        email_followers option is selected for a project
        during wallpost create but is then deleted.
        """

        # On a project page, task owners, fundraisers, and people who donated,  get a mail.

        # Create a follower by being a task owner
        task_owner1 = BlueBottleUserFactory.create()

        TaskFactory.create(
            author=task_owner1,
            project=self.project
        )

        # Add extra project and owner that should not get any email
        project_owner = BlueBottleUserFactory.create()
        ProjectFactory(owner=project_owner, status=self.phase1)

        # iLeaving a wallpost should not create a follower
        commenter = BlueBottleUserFactory.create()
        TextWallpostFactory.create(content_object=self.project,
                                   author=commenter,
                                   text="test1",
                                   email_followers=False)

        # Create a follower by donating
        donator1 = BlueBottleUserFactory.create()
        order = OrderFactory.create(user=donator1,
                                    status=StatusDefinition.CREATED)
        DonationFactory(order=order, amount=35,
                        project=self.project,
                        fundraiser=None)
        order.locked()
        order.success()
        order.save()

        # Create a follower by being a fundraiser for the project
        fundraiser_person = BlueBottleUserFactory.create()
        FundraiserFactory(project=self.project,
                          owner=fundraiser_person)

        self.assertEqual(Follow.objects.count(), 3)

        voter = BlueBottleUserFactory.create()
        VoteFactory(voter=voter, project=self.project)

        self.assertEqual(Follow.objects.count(), 4)

        # Project owner creates a wallpost and emails followers
        some_wallpost_2 = TextWallpostFactory.create(
            content_object=self.project, author=self.project.owner,
            text="test2", email_followers=True)

        mail_count = 0

        # People who should get an email: self.some_user, voter, task_owner1,
        # fundraiser_person, commenter, and donator1
        receivers = [voter.email, task_owner1.email,
                     fundraiser_person.email, donator1.email]
        for email in mail.outbox:
            if "New wallpost on" in email.subject:
                mail_count += 1
                self.assertTrue(email.to[0] in receivers)
                receivers.remove(email.to[0])
        self.assertEqual(mail_count, 4)
        self.assertEqual(receivers, [])

        # Setup for mail counting after wallpost delete
        mail_count = 0
        receivers = [voter.email, task_owner1.email,
                     fundraiser_person.email, donator1.email]

        # This time we can safely reset the email box to 0
        mail.outbox = []

        # Ember triggers a save to the record before the actual delete
        # therefore we can't use the Django delete function. This won't
        # trigger the email_follower signal to be fired again. To replicate
        # the server behavior we can simply re-save the wallpost record. This
        # will cause the signal to fire but with the "created" flag to False.
        some_wallpost_2.save()

        # Check that no emails about a new wallpost go out
        for email in mail.outbox:
            if "New wallpost on" in email.subject:
                mail_count += 1
                self.assertTrue(email.to[0] in receivers)
        self.assertEqual(mail_count, 0)
Ejemplo n.º 23
0
 def test_posted_on_fundraiser(self):
     self.wallpost.content_object = FundraiserFactory.create()
     self.wallpost.save()
     posted_on = self.admin.posted_on(self.wallpost)
     self.assertTrue('Fundraiser:' in posted_on)
     self.assertTrue(self.wallpost.content_object.title in posted_on)