示例#1
0
文件: test_amd.py 项目: webmaven/ptah
    def test_empty_spec(self):
        fn = self._create_file("[test.js]\nmodules = lib1")

        cfg = ptah.get_settings(ptah.CFG_ID_PTAH, self.registry)
        cfg['amd-specs'] = ''

        from ptah.amd import init_amd_spec, ID_AMD_SPEC

        # no amd-spec-dir
        init_amd_spec(self.config)

        storage = self.registry[ID_AMD_SPEC]
        self.assertEqual(storage, {})
示例#2
0
文件: test_amd.py 项目: webmaven/ptah
    def test_simple(self):
        fn = self._create_file("[test.js]\nmodules = lib1")

        cfg = ptah.get_settings(ptah.CFG_ID_PTAH, self.registry)
        cfg['amd-specs'] = ['%s'%fn, 'test:%s'%fn]
        cfg['amd-spec-dir'] = '/test'

        from ptah.amd import init_amd_spec, ID_AMD_SPEC
        init_amd_spec(self.config)

        storage = self.registry[ID_AMD_SPEC]
        self.assertIn('', storage)
        self.assertTrue(storage['']['test.js']['path'].endswith('/test.js'))
        self.assertIn('test', storage)
示例#3
0
文件: test_amd.py 项目: webmaven/ptah
    def test_bundle_with_url(self):
        fn = self._create_file(
            "[test.js]\nurl=http://example.com/test.js\nmodules = lib1")

        cfg = ptah.get_settings(ptah.CFG_ID_PTAH, self.registry)
        cfg['amd-specs'] = [fn]
        cfg['amd-spec-dir'] = '/test'

        from ptah.amd import init_amd_spec, ID_AMD_SPEC
        init_amd_spec(self.config)

        storage = self.registry[ID_AMD_SPEC]
        self.assertIn('url', storage['']['test.js'])
        self.assertEqual(storage['']['test.js']['url'],
                         'http://example.com/test.js')