Example #1
0
 def test_no_cdn(self):
     from van.static.cdn import config_static
     config = Mock(['add_static_view', 'package_name'])
     config.package_name = None
     config_static(
             config,
             [('name1', 'package1:path1'),
                 ('name2', 'package2:path2')])
     self.assertEqual(config.add_static_view.call_args_list,
             [((), dict(path='package1:path1', name='name1')),
                 ((), dict(path='package2:path2', name='name2'))])
Example #2
0
 def test_cdn(self):
     from van.static.cdn import config_static
     config = Mock(['add_static_view', 'package_name'])
     config.package_name = None
     cdn_url = "http://cdn.example.com/path/to/wherever"
     config_static(
             config,
             [('name1', 'van.static:path1'),
                 ('name2', 'mock:path2')],
             static_cdn=cdn_url)
     from pkg_resources import get_distribution
     url1 = '%s/van.static/%s/path1' % (cdn_url, get_distribution('van.static').version)
     url2 = '%s/mock/%s/path2' % (cdn_url, get_distribution('mock').version)
     self.assertEqual(config.add_static_view.call_args_list,
             [((), dict(path='van.static:path1', name=url1)),
                 ((), dict(path='mock:path2', name=url2))])