Esempio n. 1
0
 def setUp(self):
     super(TestMigrateUnconfirmedEmails, self).setUp()
     self.registered_user = factories.UserFactory()
     self.unconfirmed = factories.UnconfirmedUserFactory()
     self.unregistered = factories.UnregUserFactory()
     self.unregistered.emails = [self.unregistered.username]
     self.unregistered.save()
Esempio n. 2
0
    def test_unconfirmed_emails_unconfirmed_user(self):
        user = factories.UnconfirmedUserFactory()

        assert_equal(
            user.unconfirmed_emails,
            [user.username]
        )
Esempio n. 3
0
    def _add_unconfirmed_user(self):

        self.unconfirmed = factories.UnconfirmedUserFactory()

        self.user.system_tags = ['shared', 'user']
        self.unconfirmed.system_tags = ['shared', 'unconfirmed']

        self.user.aka = ['shared', 'user']
        self.unconfirmed.aka = ['shared', 'unconfirmed']
Esempio n. 4
0
 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)
Esempio n. 5
0
    def test_merge_unconfirmed_into_unmergeable(self):
        self.user.add_addon('unmergeable')
        self.user.save()
        # sanity check
        assert_false(self.user.can_be_merged)

        unconf = factories.UnconfirmedUserFactory()
        # make sure this doesn't raise an exception
        self.user.merge_user(unconf)

        unreg = factories.UnregUserFactory()
        # make sure this doesn't raise an exception
        self.user.merge_user(unreg)
Esempio n. 6
0
 def test_confirm_email_get_with_campaign(self):
     user = factories.UnconfirmedUserFactory()
     user.system_tags.append(campaigns.CAMPAIGNS['prereg']['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.CAMPAIGNS['prereg']['redirect_url']())
Esempio n. 7
0
    def test_merge_unmergeable_into_mergeable(self):
        # These states should never happen in the current codebase...
        #   but that's why we have tests.
        unconfirmed = factories.UnconfirmedUserFactory()
        unconfirmed.add_addon('unmergeable')

        with assert_raises(exceptions.MergeConflictError):
            self.user.merge_user(unconfirmed)

        unregistered = factories.UnregUserFactory()
        unregistered.add_addon('unmergeable')

        with assert_raises(exceptions.MergeConflictError):
            self.user.merge_user(unregistered)
Esempio n. 8
0
    def setUp(self):
        super(UserTestCase, self).setUp()
        self.user = factories.AuthUserFactory()
        self.unregistered = factories.UnregUserFactory()
        self.unconfirmed = factories.UnconfirmedUserFactory()
        self.USERS = (self.user, self.unregistered, self.unconfirmed)

        factories.ProjectFactory(creator=self.user)
        self.project_with_unreg_contrib = factories.ProjectFactory()
        self.project_with_unreg_contrib.add_unregistered_contributor(
            fullname='Unreg',
            email=self.unregistered.username,
            auth=auth.Auth(self.project_with_unreg_contrib.creator))
        self.project_with_unreg_contrib.save()

        self.user.system_tags = ['shared', 'user']
        self.unconfirmed.system_tags = ['shared', 'unconfirmed']

        self.user.aka = ['shared', 'user']
        self.unconfirmed.aka = ['shared', 'unconfirmed']