Beispiel #1
0
    def test_success_check_email(self):
        """
        test the success_check_email view
        """
        from c3smembership.views import success_check_email
        self.config.add_route('join', '/')
        from pyramid_mailer import get_mailer
        request = testing.DummyRequest(
            params={'appstruct': {
                'firstname': 'foo',
                'lastname': 'bar',
            }})
        request.session['appstruct'] = {
            'person': {
                'firstname': 'foo',
                'lastname': 'bar',
                'email': '*****@*****.**',
            },
            'email_confirm_code': '12345678',
        }
        mailer = get_mailer(request)
        result = success_check_email(request)
        print result
        self.assertTrue(result['lastname'] is 'bar')
        self.assertTrue(result['firstname'] is 'foo')

        self.assertEqual(len(mailer.outbox), 1)
        self.assertEqual(mailer.outbox[0].subject,
                         'C3S: confirm your email address and load your PDF')
        #self.assertEqual(mailer.outbox[0]., "hello world")

        verif_link = "https://pretest.c3s.cc/verify/[email protected]/12345678"
        self.assertTrue("hello foo bar !" in mailer.outbox[0].body)
        self.assertTrue(verif_link in mailer.outbox[0].body)
Beispiel #2
0
    def test_success_check_email_redirect(self):
        """
        test the success_check_email view redirection when appstruct is missing
        """
        from c3smembership.views import success_check_email
        self.config.add_route('join', '/')
        from pyramid_mailer import get_mailer
        request = testing.DummyRequest()
        result = success_check_email(request)

        self.assertEqual('302 Found', result._status)
        self.assertEqual('http://example.com/', result.location)
Beispiel #3
0
    def test_success_check_email_redirect(self):
        """
        test the success_check_email view redirection when appstruct is missing
        """
        from c3smembership.views import success_check_email
        self.config.add_route('join', '/')
        from pyramid_mailer import get_mailer
        request = testing.DummyRequest()
        result = success_check_email(request)

        self.assertEqual('302 Found', result._status)
        self.assertEqual('http://example.com/', result.location)
Beispiel #4
0
    def test_success_check_email(self):
        """
        test the success_check_email view
        """
        from c3smembership.views import success_check_email
        self.config.add_route('join', '/')
        from pyramid_mailer import get_mailer
        request = testing.DummyRequest(
            params={
                'appstruct': {
                    'firstname': 'foo',
                    'lastname': 'bar',
                }
            }
        )
        request.session['appstruct'] = {
            'person': {
                'firstname': 'foo',
                'lastname': 'bar',
                'email': '*****@*****.**',
            },
            'email_confirm_code': '12345678',
        }
        mailer = get_mailer(request)
        result = success_check_email(request)
        #print result
        self.assertTrue(result['lastname'] is 'bar')
        self.assertTrue(result['firstname'] is 'foo')

        self.assertEqual(len(mailer.outbox), 1)
        self.assertEqual(
            mailer.outbox[0].subject,
            'C3S: confirm your email address and load your PDF')
        #self.assertEqual(mailer.outbox[0]., "hello world")

        verif_link = "https://yes.c3s.cc/verify/[email protected]/12345678"
        self.assertTrue("hello foo bar !" in mailer.outbox[0].body)
        self.assertTrue(verif_link in mailer.outbox[0].body)