def setUp(self): TestCase.setUp(self) self.jane = self.make_user("jane", group='cg_moderator') self.bob = self.make_user("bob", group='cg_moderator') self.brian = self.make_user("brian", group='cg_moderator') self.stacy = self.make_user("stacy") self.channel = self.make_channel(self.stacy)
def setUp(self): TestCase.setUp(self) self.users = [self.make_user('user%i' % i) for i in range(5)] self.channels = [self.make_channel(self.users[0], 'A') for i in range(10)] self.channels.append(self.make_channel(self.users[0], 'U')) # subscriptions ip0 = '0.0.0.0' ip1 = '1.1.1.1' ip2 = '2.2.2.2' ip3 = '3.3.3.3' self.add_multiple_subscriptions(self.channels[0], ip0, ip1, ip2) self.add_multiple_subscriptions(self.channels[1], ip1, ip2) self.add_multiple_subscriptions(self.channels[2], ip2, ip3) self.add_subscription(self.channels[3], ip0) self.add_multiple_subscriptions(self.channels[4], ip0, ip1) self.add_subscription(self.channels[5], ip1, ignore=True) self.add_subscription(self.channels[6], ip1, timestamp=datetime.now()-timedelta(days=3)) self.add_subscription(self.channels[7], ip1, timestamp=datetime.now()-timedelta(days=31 * 7)) self.add_subscription(self.channels[8], ip3) self.add_subscription(self.channels[9], ip1, timestamp=datetime.now()-timedelta(days=3)) self.add_multiple_subscriptions(self.channels[10], ip1, ip2) # ratings self.add_ratings(0, 1, 1, 3, 4, 5) self.add_ratings(1, 2, 2, 5, 4, 3) self.add_ratings(2, 5, 5, 3, 4) self.add_ratings(3, 4, 4, 5, 1, 2) self.add_ratings(4, 3, 3, 5, 2, 1)
def setUp(self): TestCase.setUp(self) self.user = self.make_user('mary') self.admin = self.make_user('joe') self.admin.is_superuser = True self.admin.save() self.other_user = self.make_user('bobby', group='cg_moderator')
def setUp(self): TestCase.setUp(self) self.owner = self.make_user('owner') self.owner.get_profile().approved = True self.owner.get_profile().save() self.channels = [] for i in range(2): channel = self.make_channel(self.owner, state='A') channel.name = 'My Channel %i' % i channel.save() self.channels.append(channel) self.categories = categories = [] self.languages = languages = [] self.items = [] for n in range(2): cat = Category(name='category%i' % n) cat.save() lang = Language(name='language%i' % n) lang.save() item = Item() item.channel_id = self.channels[0].id item.url = self.channels[0].url + '?item=%i' % n item.name = 'item%i' % n item.description = 'Item' item.size = i item.date = datetime.now() item.save() item.save_thumbnail( file(test_data_path('thumbnail.jpg'))) categories.append(cat) languages.append(lang) self.items.append(item) self.channels[0].categories.add(*categories) self.channels[0].language = languages[0] self.channels[0].add_tags(self.owner, ['tag0', 'tag1']) self.channels[0].save_thumbnail( file(test_data_path('thumbnail.jpg'))) self.channels[1].description = 'This is a different description.' self.channels[1].save() # the order is important because of throttling so we do them in reverse # order Subscription.objects.add(self.channels[0], '123.123.123.123', timestamp=datetime.now() - timedelta(days=1)) Subscription.objects.add(self.channels[0], '123.123.123.123') for i in range(5): user = self.make_user('foo%i' % i) user.get_profile().approved = True user.get_profile().save() for channel in self.channels: rating, _ = Rating.objects.get_or_create(channel=channel, user=user) rating.rating = i + 1 rating.save()
def setUp(self): TestCase.setUp(self) self.owner = self.make_user('owner') self.owner.get_profile().approved = True self.owner.get_profile().save() self.channels = [] for i in range(2): channel = self.make_channel(self.owner, state='A') channel.name = 'My Channel %i' % i channel.save() self.channels.append(channel) self.categories = categories = [] self.languages = languages = [] self.items = [] for n in range(2): cat = Category(name='category%i' % n) cat.save() lang = Language(name='language%i' % n) lang.save() item = Item() item.channel_id = self.channels[0].id item.url = self.channels[0].url + '?item=%i' % n item.name = 'item%i' % n item.description = 'Item' item.size = i item.date = datetime.now() item.save() item.save_thumbnail(file(test_data_path('thumbnail.jpg'))) categories.append(cat) languages.append(lang) self.items.append(item) self.channels[0].categories.add(*categories) self.channels[0].language = languages[0] self.channels[0].add_tags(self.owner, ['tag0', 'tag1']) self.channels[0].save_thumbnail(file(test_data_path('thumbnail.jpg'))) self.channels[1].description = 'This is a different description.' self.channels[1].save() # the order is important because of throttling so we do them in reverse # order Subscription.objects.add(self.channels[0], '123.123.123.123', timestamp=datetime.now() - timedelta(days=1)) Subscription.objects.add(self.channels[0], '123.123.123.123') for i in range(5): user = self.make_user('foo%i' % i) user.get_profile().approved = True user.get_profile().save() for channel in self.channels: rating, _ = Rating.objects.get_or_create(channel=channel, user=user) rating.rating = i + 1 rating.save()
def setUp(self): TestCase.setUp(self) self.ralph = self.make_user('ralph') self.channel = self.make_channel(self.ralph) self.supermod = self.make_user('supermod', group=['cg_supermoderator', 'cg_moderator']) self.joe = self.make_user('joe', group='cg_moderator') self.schmoe = self.make_user('schmoe')
def setUp(self): TestCase.setUp(self) self.owner = self.make_user('owner') self.regular = self.make_user('regular') self.regular.get_profile().approved = True self.regular.get_profile().save() self.mod = self.make_user('mod', group='cg_moderator') self.super = self.make_user( 'super', group=['cg_moderator', 'cg_supermoderator']) self.channel = self.make_channel(self.owner, state='A')
def setUp(self): TestCase.setUp(self) self.owner = self.make_user('owner') self.regular = self.make_user('regular') self.regular.get_profile().approved = True self.regular.get_profile().save() self.mod = self.make_user('mod', group='cg_moderator') self.super = self.make_user('super', group=['cg_moderator', 'cg_supermoderator']) self.channel = self.make_channel(self.owner, state='A')
def setUp(self): TestCase.setUp(self) self.user = self.make_user('fred') self.moderator = self.make_user('greg', group='cg_moderator') self.supermod = self.make_user('henrietta', group=['cg_supermoderator', 'cg_moderator']) self.random_user = self.make_user("jane") self.user.email = '*****@*****.**' self.user.save() self.channel = self.make_channel(self.user)
def setUp(self): TestCase.setUp(self) self.jane = self.make_user("jane") self.jane.is_superuser = True self.jane.save() self.bob = self.make_user("bob") self.cathy = self.make_user("cathy") self.adrian = self.make_user("adrian") self.judy = self.make_user("judy") self.judy.email = '*****@*****.**' self.judy.save()
def setUp(self): TestCase.setUp(self) self.admin = self.make_user('admin') self.admin.is_superuser = True self.admin.save() self.user = self.make_user('user') self.plain = self.make_user('plain') self.channels = [] for i in range(3): channel = self.make_channel(self.user, state='A') self.channels.append(channel)
def setUp(self): TestCase.setUp(self) self.user = self.make_user('user') self.mod = self.make_user('mod', group='cg_moderator') self.supermod = self.make_user('supermod', group=['cg_moderator', 'cg_supermoderator']) self.new_post_data = { 'title': 'test title', 'body': 'test body', } self.new_post_data_email = self.new_post_data.copy() self.new_post_data_email['send-email'] = 1
def setUp(self): TestCase.setUp(self) self.channel_owner = self.make_user('foobar') self.channel_owner.email = '*****@*****.**' self.channel_owner.save() self.channel = self.make_channel(self.channel_owner) self.non_owner = self.make_user('tony') self.moderator = self.make_user('greg', group='cg_moderator') self.moderator_note = self.make_note('foo') self.owner_note = self.make_note('bar') self.channel.notes.add(self.moderator_note) self.channel.notes.add(self.owner_note)
def setUp(self): TestCase.setUp(self) self.owner = self.make_user('owner') self.owner.get_profile().approved = True self.owner.get_profile().save() self.channel = self.make_channel(self.owner) self.users = [] for rating in range(6): user = self.make_user('user%i' % rating) user.get_profile().approved = True user.get_profile().save() self.users.append(user) self.rate_channel(self.channel, user, rating) self.logout()
def setUp(self): TestCase.setUp(self) self.change_setting_for_test('MAX_FEATURES', 3) self.owner = self.make_user('wanda', group=['cg_supermoderator']) self.channels = [self.make_channel(self.owner, state='A') for i in range(8)] self.users = [self.make_user('user%i' % i, group=['cg_supermoderator']) for i in range(5)] self.old_fq_save = FeaturedQueue.save def mockSave(fqself): # slow down saves to make distinct timestamps self.old_fq_save(fqself) time.sleep(1) FeaturedQueue.save = mockSave
def setUp(self): TestCase.setUp(self) self.ralph = self.make_user('ralph') self.channel = self.make_channel() self.channel.update_items( feedparser_input=open(test_data_path('feed.xml'))) self.channel.name = "Rocketboom" self.channel.description = ("Daily with Joanne Colan " "(that's right... Joanne Colan") self.channel.state = Channel.APPROVED self.channel.save() ChannelSearchData.objects.update(self.channel) # make bogus channels so that the the fulltext indexes work for x in range(10): c = self.make_channel(state=Channel.APPROVED) ChannelSearchData.objects.update(c) self.pages = {}
def test_website_url_unique_for_site(self): channel = self.make_channel(self.joe) channel.url = None channel.save() mod = self.make_user('moderator', group='cg_moderator') TestCase.login(self, mod) response = self.post_data('/submit/step1', {'name': 'New Site'}) self.assertRedirect(response, '/submit/step2') response = self.submit(dont_send='url', website_url=channel.website_url) self.assertEquals(response.context[0]['form'].errors.keys(), ['website_url']) # should work if the other channel is a feed channel.url = 'http://www.myblog.com/' channel.save() response = self.submit(dont_send='url', website_url=channel.website_url) self.check_submit_worked(response)
def setUp(self): TestCase.setUp(self) self.users = [self.make_user('user%i' % i) for i in range(5)] self.channels = [ self.make_channel(self.users[0], 'A') for i in range(10) ] self.channels.append(self.make_channel(self.users[0], 'U')) # subscriptions ip0 = '0.0.0.0' ip1 = '1.1.1.1' ip2 = '2.2.2.2' ip3 = '3.3.3.3' self.add_multiple_subscriptions(self.channels[0], ip0, ip1, ip2) self.add_multiple_subscriptions(self.channels[1], ip1, ip2) self.add_multiple_subscriptions(self.channels[2], ip2, ip3) self.add_subscription(self.channels[3], ip0) self.add_multiple_subscriptions(self.channels[4], ip0, ip1) self.add_subscription(self.channels[5], ip1, ignore=True) self.add_subscription(self.channels[6], ip1, timestamp=datetime.now() - timedelta(days=3)) self.add_subscription(self.channels[7], ip1, timestamp=datetime.now() - timedelta(days=31 * 7)) self.add_subscription(self.channels[8], ip3) self.add_subscription(self.channels[9], ip1, timestamp=datetime.now() - timedelta(days=3)) self.add_multiple_subscriptions(self.channels[10], ip1, ip2) # ratings self.add_ratings(0, 1, 1, 3, 4, 5) self.add_ratings(1, 2, 2, 5, 4, 3) self.add_ratings(2, 5, 5, 3, 4) self.add_ratings(3, 4, 4, 5, 1, 2) self.add_ratings(4, 3, 3, 5, 2, 1)
def setUp(self): TestCase.setUp(self) self.ralph = self.make_user('ralph') self.channel = self.make_channel()
def tearDown(self): TestCase.tearDown(self) FeaturedQueue.save = self.old_fq_save del self.old_fq_save
def setUp(self): TestCase.setUp(self) self.joe = self.make_user('joe') self.cat1 = Category.objects.create(name='foo') self.cat2 = Category.objects.create(name='bar')
def setUp(self): TestCase.setUp(self) self.old_clean = fields.URLField.clean fields.URLField.clean = self._patch_urlfield_clean owner = self.make_user('owner') self.channel = self.make_channel(owner)
def setUp(self): TestCase.setUp(self) if self.model is not None: self.model_name = self.model._meta.object_name.lower()
def setUp(self): TestCase.setUp(self) self.user = self.make_user('mary')
def make_channel(self, **kwargs): return TestCase.make_channel(self, self.ralph, **kwargs)
def setUp(self): TestCase.setUp(self) self.ralph = self.make_user('ralph') self.channel = self.make_channel(self.ralph)
def setUp(self): TestCase.setUp(self) self.ben = self.make_user('ben') self.nick = self.make_user('nick') self.channel = self.make_channel(self.ben)
def setUp(self): TestCase.setUp(self) self.user = self.make_user('mary') self.channel = self.make_channel(self.user)
def login(self): TestCase.login(self, 'joe') return self.get_page('/submit/step1')
def login(self, username): TestCase.login(self, username) return self.get_page('/moderate')
def setUp(self): TestCase.setUp(self) owner = self.make_user('owner') self.channel = self.make_channel(owner)