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()
def _add_unregistered_user(self): self.unregistered = factories.UnregUserFactory() 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()
def test_unreg_users_do_show_on_projects(self): with run_celery_tasks(): unreg = factories.UnregUserFactory(fullname='Robert Paulson') self.project = factories.ProjectFactory( title='Glamour Rock', creator=unreg, is_public=True, ) results = query(unreg.fullname)['results'] assert_equal(len(results), 1)
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)
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)
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']
def test_unconfirmed_emails_unregistered_user(self): assert_equal(factories.UnregUserFactory().unconfirmed_emails, [])
def test_unreg_users_dont_show_in_search(self): unreg = factories.UnregUserFactory() contribs = search.search_contributor(unreg.fullname) assert_equal(len(contribs['users']), 0)