Ejemplo n.º 1
0
 def test_nodetype_feed_no_authors(self):
     original_feeds_format = feeds.FEEDS_FORMAT
     feeds.FEEDS_FORMAT = ''
     nodetype = self.create_published_nodetype()
     nodetype.authors.clear()
     feed = NodetypeFeed()
     self.assertEquals(feed.item_author_name(nodetype), None)
     feeds.FEEDS_FORMAT = original_feeds_format
Ejemplo n.º 2
0
 def test_nodetype_feed_no_authors(self):
     original_feeds_format = feeds.FEEDS_FORMAT
     feeds.FEEDS_FORMAT = ''
     nodetype = self.create_published_nodetype()
     nodetype.authors.clear()
     feed = NodetypeFeed()
     self.assertEquals(feed.item_author_name(nodetype), None)
     feeds.FEEDS_FORMAT = original_feeds_format
Ejemplo n.º 3
0
 def test_nodetype_feed(self):
     original_feeds_format = feeds.FEEDS_FORMAT
     feeds.FEEDS_FORMAT = ''
     nodetype = self.create_published_nodetype()
     feed = NodetypeFeed()
     self.assertEquals(feed.item_pubdate(nodetype), nodetype.creation_date)
     self.assertEquals(feed.item_metatypes(nodetype), [self.metatype.title])
     self.assertEquals(feed.item_author_name(nodetype),
                       self.author.username)
     self.assertEquals(feed.item_author_email(nodetype), self.author.email)
     self.assertEquals(
         feed.item_author_link(nodetype),
         'http://example.com/authors/%s/' % self.author.username)
     # Test a NoReverseMatch for item_author_link
     self.author.username = '******'
     self.author.save()
     feed.item_author_name(nodetype)
     self.assertEquals(feed.item_author_link(nodetype),
                       'http://example.com')
     feeds.FEEDS_FORMAT = original_feeds_format
Ejemplo n.º 4
0
 def test_nodetype_feed(self):
     original_feeds_format = feeds.FEEDS_FORMAT
     feeds.FEEDS_FORMAT = ''
     nodetype = self.create_published_nodetype()
     feed = NodetypeFeed()
     self.assertEquals(feed.item_pubdate(nodetype), nodetype.creation_date)
     self.assertEquals(feed.item_metatypes(nodetype), [self.metatype.title])
     self.assertEquals(feed.item_author_name(nodetype), self.author.username)
     self.assertEquals(feed.item_author_email(nodetype), self.author.email)
     self.assertEquals(
         feed.item_author_link(nodetype),
         'http://example.com/authors/%s/' % self.author.username)
     # Test a NoReverseMatch for item_author_link
     self.author.username = '******'
     self.author.save()
     feed.item_author_name(nodetype)
     self.assertEquals(feed.item_author_link(nodetype), 'http://example.com')
     feeds.FEEDS_FORMAT = original_feeds_format
Ejemplo n.º 5
0
 def test_nodetype_feed_enclosure(self):
     original_feeds_format = feeds.FEEDS_FORMAT
     feeds.FEEDS_FORMAT = ''
     nodetype = self.create_published_nodetype()
     feed = NodetypeFeed()
     self.assertEquals(feed.item_enclosure_url(nodetype),
                       'http://example.com/image.jpg')
     nodetype.content = 'My test content with image <img src="image.jpg" />',
     nodetype.save()
     self.assertEquals(feed.item_enclosure_url(nodetype),
                       'http://example.com/image.jpg')
     nodetype.content = 'My test content with image ' \
                     '<img src="http://test.com/image.jpg" />'
     nodetype.save()
     self.assertEquals(feed.item_enclosure_url(nodetype),
                       'http://test.com/image.jpg')
     nodetype.image = 'image_field.jpg'
     nodetype.save()
     self.assertEquals(feed.item_enclosure_url(nodetype),
                       '%simage_field.jpg' % settings.MEDIA_URL)
     self.assertEquals(feed.item_enclosure_length(nodetype), '100000')
     self.assertEquals(feed.item_enclosure_mime_type(nodetype),
                       'image/jpeg')
     feeds.FEEDS_FORMAT = original_feeds_format
Ejemplo n.º 6
0
 def test_nodetype_feed_enclosure(self):
     original_feeds_format = feeds.FEEDS_FORMAT
     feeds.FEEDS_FORMAT = ''
     nodetype = self.create_published_nodetype()
     feed = NodetypeFeed()
     self.assertEquals(
         feed.item_enclosure_url(nodetype), 'http://example.com/image.jpg')
     nodetype.content = 'My test content with image <img src="image.jpg" />',
     nodetype.save()
     self.assertEquals(
         feed.item_enclosure_url(nodetype), 'http://example.com/image.jpg')
     nodetype.content = 'My test content with image ' \
                     '<img src="http://test.com/image.jpg" />'
     nodetype.save()
     self.assertEquals(
         feed.item_enclosure_url(nodetype), 'http://test.com/image.jpg')
     nodetype.image = 'image_field.jpg'
     nodetype.save()
     self.assertEquals(feed.item_enclosure_url(nodetype),
                       '%simage_field.jpg' % settings.MEDIA_URL)
     self.assertEquals(feed.item_enclosure_length(nodetype), '100000')
     self.assertEquals(feed.item_enclosure_mime_type(nodetype), 'image/jpeg')
     feeds.FEEDS_FORMAT = original_feeds_format