def test_media_description(self): """ 'media_description' should be tried as a fallback if 'description' isn't available. """ entry = { 'title': 'title', 'media_description': 'description', 'enclosures': [{'href': 'http://www.getmiro.com/video.flv'}]} i = Item.from_feedparser_entry(entry) self.assertEquals(i.description, 'description')
def test_do_not_require_enclosure_type(self): """ Enclosures should not require a 'type' attribute. """ entry = {'title': 'title', 'description': 'description', 'enclosures': [{'href': 'http://www.getmiro.com/video.flv'}]} i = Item.from_feedparser_entry(entry) self.assertEquals(i.name, 'title') self.assertEquals(i.description, 'description') self.assertEquals(i.url, 'http://www.getmiro.com/video.flv') self.assertEquals(i.mime_type, 'video/unknown')
def test_media_description(self): """ 'media_description' should be tried as a fallback if 'description' isn't available. """ entry = { 'title': 'title', 'media_description': 'description', 'enclosures': [{ 'href': 'http://www.getmiro.com/video.flv' }] } i = Item.from_feedparser_entry(entry) self.assertEquals(i.description, 'description')
def test_do_not_require_enclosure_type(self): """ Enclosures should not require a 'type' attribute. """ entry = { 'title': 'title', 'description': 'description', 'enclosures': [{ 'href': 'http://www.getmiro.com/video.flv' }] } i = Item.from_feedparser_entry(entry) self.assertEquals(i.name, 'title') self.assertEquals(i.description, 'description') self.assertEquals(i.url, 'http://www.getmiro.com/video.flv') self.assertEquals(i.mime_type, 'video/unknown')
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()