Ejemplo n.º 1
0
    def test_success_check_email(self):
        """
        test the success_check_email view
        """
        from c3smembership.views.afm 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': '*****@*****.**',
                'locale': 'de',
            },
            '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("Hallo foo bar!" in mailer.outbox[0].body)
        self.assertTrue(verif_link in mailer.outbox[0].body)
Ejemplo n.º 2
0
    def test_success_check_email_redirect(self):
        """
        test the success_check_email view redirection when appstruct is missing
        """
        from c3smembership.views.afm import success_check_email
        self.config.add_route('join', '/')
        request = testing.DummyRequest()
        result = success_check_email(request)

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

        self.assertEqual('302 Found', result._status)
        self.assertEqual('http://example.com/', result.location)
Ejemplo n.º 4
0
    def test_success_check_email(self):
        """
        test the success_check_email view
        """
        from c3smembership.views.afm import success_check_email
        self.config.add_route('join', '/')
        request = testing.DummyRequest(
            params={
                'appstruct': {
                    'firstname': 'foo',
                    'lastname': 'bar',
                }
            }
        )
        request.session['appstruct'] = {
            'person': {
                'firstname': 'foo',
                'lastname': 'bar',
                'email': '*****@*****.**',
                'password': '******',
                'address1': 'Some Street',
                'address2': '',
                'postcode': 'ABC123',
                'city': 'Stockholm',
                'country': 'SE',
                'locale': 'de',
                'date_of_birth': '1980-01-01',
            },
            'membership_info': {
                'membership_type': 'person',
                'member_of_colsoc': 'no',
                'name_of_colsoc': '',
            },
            'shares': {
                'num_shares': '3',
            },
        }
        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]/"
        self.assertTrue("Hallo foo bar!" in mailer.outbox[0].body)
        self.assertTrue(verif_link in mailer.outbox[0].body)
Ejemplo n.º 5
0
    def test_success_check_email(self):
        """
        test the success_check_email view
        """
        from c3smembership.views.afm 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': '*****@*****.**',
                '_LOCALE_': 'de',
            },
            '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("Hallo foo bar!" in mailer.outbox[0].body)
        self.assertTrue(verif_link in mailer.outbox[0].body)