~michael.nelson/ubuntu-webcatalog/1267731-import-sca-apps-error

« back to all changes in this revision

Viewing changes to src/webcatalog/tests/test_templatetags.py

  • Committer: Anthony Lenton
  • Date: 2013-02-27 15:32:56 UTC
  • mfrom: (176.1.2 use-thumbnails)
  • Revision ID: anthony.lenton@canonical.com-20130227153256-n183iopl4nqyryn6
[r=michael.nelson] Made use of the recent thumbnailing feature in sca.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    install_options,
31
31
    rating_summary,
32
32
    visible_page_range,
 
33
    thumbnail_url,
33
34
)
34
35
from webcatalog.tests.factory import TestCaseWithFactory
35
36
from webcatalog.tests.helpers import patch_settings
312
313
 
313
314
        self.assertEqual([1, 1, 1, 0.5, 0], result['stars'])
314
315
        self.assertEqual(234, result['total'])
 
316
 
 
317
 
 
318
class ThumbnailURLTestCase(TestCaseWithFactory):
 
319
    def test_thumbnail_url(self):
 
320
        staging_sca = 'http://sc.staging.ubuntu.com/'
 
321
        staging_dp = 'http://developer.staging.ubuntu.com/'
 
322
        prod_sca = 'http://software-center.ubuntu.com/'
 
323
        prod_dp = 'http://myapps.developer.ubuntu.com/'
 
324
        cases = [
 
325
            (staging_sca + 'site_media/example.jpg',
 
326
             staging_sca + 'thumbnail/225x170/example.jpg'),
 
327
            (staging_dp + 'something_different/foo.jpg',
 
328
             staging_dp + 'something_different/foo.jpg'),
 
329
            (prod_dp + 'site_media/app/example.jpg',
 
330
             prod_dp + 'thumbnail/225x170/app/example.jpg'),
 
331
            (prod_sca + 'foobar.jpg',
 
332
             prod_sca + 'foobar.jpg'),
 
333
            ('http://example.com/someother.jpg',
 
334
             'http://example.com/someother.jpg'),
 
335
        ]
 
336
        for src, expected in cases:
 
337
 
 
338
            dst = thumbnail_url(src)
 
339
 
 
340
            self.assertEqual(expected, dst)