Exemple #1
0
 def test_newsletter_en_only(self):
     """Only show the newsletter to English locales."""
     user = FacebookUserFactory()
     ok_('newsletter_form' in self._app_context(user=user, locale='en-US'))
     ok_('newsletter_form' in self._app_context(user=user, locale='en-AU'))
     ok_(not 'newsletter_form' in self._app_context(user=user, locale='fr'))
     ok_(not 'newsletter_form' in self._app_context(user=user, locale='de'))
Exemple #2
0
    def test_facebook_auth(self, update_user_info):
        """
        If the user has authed via the Facebook auth mechanism, execute the
        view.
        """
        request = self.request()
        user = FacebookUserFactory()
        fb_login(request, user)

        response = view(request)
        eq_(response, True)
Exemple #3
0
 def test_newsletter_form(self, NewsletterSubscriptionForm):
     """If the user is logged in, include the newsletter_form."""
     user = FacebookUserFactory()
     ok_('newsletter_form' in self._app_context(user=user, locale='en-US'))
     NewsletterSubscriptionForm.assert_called_with(user,
                                                   auto_id='newsletter_%s')
Exemple #4
0
 def user(self, **kwargs):
     user = FacebookUserFactory(**kwargs)
     user.save = Mock()
     return user