示例#1
0
 def test_templates(self):
     packager = Packager()
     packages = packager.create_packages({
         'templates': {
             'source_filenames': (_('pipeline/templates/photo/list.jst'), ),
             'output_filename': 'templates.js',
         }
     })
     self.assertEqual(packages['templates'].templates,
                      [_('pipeline/templates/photo/list.jst')])
示例#2
0
 def test_package_for(self):
     packager = Packager()
     packager.packages['js'] = packager.create_packages({
         'application': {
             'source_filenames': (_('pipeline/js/application.js'), ),
             'output_filename': 'application.js'
         }
     })
     try:
         packager.package_for('js', 'application')
     except PackageNotFound:
         self.fail()
     try:
         packager.package_for('js', 'broken')
         self.fail()
     except PackageNotFound:
         pass
示例#3
0
 def test_templates(self):
     packager = Packager()
     packages = packager.create_packages({
         'templates': {
             'source_filenames': (
                 'templates/photo/list.jst',
             ),
             'output_filename': 'templates.r?.js',
         }
     })
     self.assertEqual(packages, {
         'templates': {
             'templates': ['templates/photo/list.jst'],
             'manifest': True,
             'paths': [],
             'context': {},
             'output': 'templates.r?.js'
         }
     })
示例#4
0
 def test_external_urls(self):
     packager = Packager()
     packages = packager.create_packages({
         'jquery': {
             'external_urls': ('//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js',)
         },
         'application': {
             'source_filenames': ('js/application.js',),
             'output_filename': 'application.r?.js'
         }
     })
     self.assertEqual(packages, {
         'jquery': {
             'externals': ('//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js',)
         },
         'application': {
             'context': {},
             'manifest': True,
             'output': 'application.r?.js',
             'paths': ['js/application.js'],
             'templates': []
         }
     })