Beispiel #1
0
def subscribe(request):
    from django_subs.utils import subscribe
    subscribe(
        request.POST['subs_id'],
        request.POST['email'],
    )
    return redirect(request.POST['next'])
Beispiel #2
0
def subscribe(request):
    from django_subs.utils import subscribe
    subscribe(
        request.POST['subs_id'],
        request.POST['email'],
    )
    return redirect(request.POST['next'])
Beispiel #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)
Beispiel #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)
Beispiel #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())
Beispiel #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())
Beispiel #7
0
 def testUnSubscribeTwiceViaFunction(self):
     hash = subscribe('blah-minor', '*****@*****.**')
     self.assertEqual(1, Subscription.objects.count())
     unsubscribe(hash)
     self.assertEqual(0, Subscription.objects.count())
Beispiel #8
0
 def testUnSubscribeTwiceViaFunction(self):
     hash = subscribe('blah-minor', '*****@*****.**')
     self.assertEqual(1, Subscription.objects.count())
     unsubscribe(hash)
     self.assertEqual(0, Subscription.objects.count())