def test_new_user_unconfirmed(self): user = factories.UnconfirmedUserFactory() docs = query_user(user.fullname)['results'] assert_equal(len(docs), 0) token = user.get_confirmation_token(user.username) user.confirm_email(token) user.save() docs = query_user(user.fullname)['results'] assert_equal(len(docs), 1)
def test_confirm_email_get_with_campaign(self): for key, value in campaigns.CAMPAIGNS.items(): user = factories.UnconfirmedUserFactory() user.add_system_tag(value.get('system_tag')) user.save() token = user.get_confirmation_token(user.username) kwargs = { 'uid': user._id, } with self.app.app.test_request_context(), mock_auth(user): res = auth_views.confirm_email_get(token, **kwargs) assert_equal(res.status_code, http.FOUND) assert_equal(res.location, campaigns.campaign_url_for(key))