Exemple #1
0
def subscribe(request):
    from django_subs.utils import subscribe
    subscribe(
        request.POST['subs_id'],
        request.POST['email'],
    )
    return redirect(request.POST['next'])
Exemple #2
0
def subscribe(request):
    from django_subs.utils import subscribe
    subscribe(
        request.POST['subs_id'],
        request.POST['email'],
    )
    return redirect(request.POST['next'])
Exemple #3
0
    def testSendMessageUsesSimpleTemplate(self):
        clear()
        hash = subscribe('blah',  '*****@*****.**')
        subscribe('blah',  '*****@*****.**')
        subscribe('minor', '*****@*****.**')

        send_message('blah', 'subject', 'Test message')

        self.assertEqual(2, len(mail.outbox))
        self.assertEqual(['*****@*****.**'], mail.outbox[0].to)
        self.assertEqual(['*****@*****.**'], mail.outbox[1].to)

        body = mail.outbox[0].body

        self.assert_('Test message' in body)
        self.assert_(hash in body)
Exemple #4
0
    def testSendMessageUsesSimpleTemplate(self):
        clear()
        hash = subscribe('blah', '*****@*****.**')
        subscribe('blah', '*****@*****.**')
        subscribe('minor', '*****@*****.**')

        send_message('blah', 'subject', 'Test message')

        self.assertEqual(2, len(mail.outbox))
        self.assertEqual(['*****@*****.**'], mail.outbox[0].to)
        self.assertEqual(['*****@*****.**'], mail.outbox[1].to)

        body = mail.outbox[0].body

        self.assert_('Test message' in body)
        self.assert_(hash in body)
Exemple #5
0
    def testUnSubscribeViaView(self):
        c = Client()

        hash = subscribe('blah-minor', '*****@*****.**')
        self.assertEqual(1, Subscription.objects.count())

        response = c.post(reverse('unsubscribe'), dict(hash=hash, next='/'))
        self.assertRedirects(response, '/')
        self.assertEqual(0, Subscription.objects.count())
Exemple #6
0
    def testUnSubscribeViaView(self):
        c = Client()

        hash = subscribe('blah-minor', '*****@*****.**')
        self.assertEqual(1, Subscription.objects.count())

        response = c.post(
            reverse('unsubscribe'),
            dict(
                hash = hash,
                next = '/'
            )
        )
        self.assertRedirects(response, '/')
        self.assertEqual(0, Subscription.objects.count())
Exemple #7
0
 def testUnSubscribeTwiceViaFunction(self):
     hash = subscribe('blah-minor', '*****@*****.**')
     self.assertEqual(1, Subscription.objects.count())
     unsubscribe(hash)
     self.assertEqual(0, Subscription.objects.count())
Exemple #8
0
 def testUnSubscribeTwiceViaFunction(self):
     hash = subscribe('blah-minor', '*****@*****.**')
     self.assertEqual(1, Subscription.objects.count())
     unsubscribe(hash)
     self.assertEqual(0, Subscription.objects.count())