Пример #1
0
    def test_find_all_file_trim_base_path(self):
        """Find all files in folder, trim base path"""
        files = fd.discover_files(base_path, sub_path='a', trim_base_path=True)
        self.assertTrue(files[0].startswith('a/'))

        files = fd.discover_files(base_path, sub_path='b', trim_base_path=True)
        self.assertTrue(files[0].startswith('b/'))
Пример #2
0
    def test_find_all_file_trim_base_path(self):
        """Find all files in folder, trim base path"""
        files = fd.discover_files(base_path, sub_path='a', trim_base_path=True)
        self.assertTrue(files[0].startswith('a/'))

        files = fd.discover_files(base_path, sub_path='b', trim_base_path=True)
        self.assertTrue(files[0].startswith('b/'))
Пример #3
0
    def test_sort_js_files(self):
        """Sort all JavaScript files
        """
        files = fd.discover_files(base_path, ext='.js')
        sources, mocks, specs = fd.sort_js_files(files)

        self.assertEqual(len(sources), 6)
        self.assertEqual(len(mocks), 2)
        self.assertEqual(len(specs), 6)

        self.assertTrue(sources[0].endswith('.module.js'))
        self.assertTrue(sources[1].endswith('.module.js'))

        self.assertTrue(sources[2].endswith('.controller.js'))
        self.assertTrue(sources[3].endswith('.directive.js'))
        self.assertTrue(sources[4].endswith('.controller.js'))
        self.assertTrue(sources[5].endswith('.directive.js'))

        self.assertTrue(mocks[0].endswith('.mock.js'))
        self.assertTrue(mocks[1].endswith('.mock.js'))

        self.assertTrue(specs[0].endswith('.spec.js'))
        self.assertTrue(specs[1].endswith('.spec.js'))
        self.assertTrue(specs[2].endswith('.spec.js'))
        self.assertTrue(specs[3].endswith('.spec.js'))
        self.assertTrue(specs[4].endswith('.spec.js'))
        self.assertTrue(specs[5].endswith('.spec.js'))
Пример #4
0
    def test_sort_js_files(self):
        """Sort all JavaScript files"""
        files = fd.discover_files(base_path, ext='.js')
        sources, mocks, specs = fd.sort_js_files(files)

        self.assertEqual(len(sources), 6)
        self.assertEqual(len(mocks), 2)
        self.assertEqual(len(specs), 6)

        self.assertTrue(sources[0].endswith('.module.js'))
        self.assertTrue(sources[1].endswith('.module.js'))

        self.assertTrue(sources[2].endswith('.controller.js'))
        self.assertTrue(sources[3].endswith('.directive.js'))
        self.assertTrue(sources[4].endswith('.controller.js'))
        self.assertTrue(sources[5].endswith('.directive.js'))

        self.assertTrue(mocks[0].endswith('.mock.js'))
        self.assertTrue(mocks[1].endswith('.mock.js'))

        self.assertTrue(specs[0].endswith('.spec.js'))
        self.assertTrue(specs[1].endswith('.spec.js'))
        self.assertTrue(specs[2].endswith('.spec.js'))
        self.assertTrue(specs[3].endswith('.spec.js'))
        self.assertTrue(specs[4].endswith('.spec.js'))
        self.assertTrue(specs[5].endswith('.spec.js'))
Пример #5
0
JS_BASE = '%s/js' % TEMPLATE_GENERATOR_BASE

PREFIX_URL = '%s/' % STATIC_URL.strip('/')
ADD_SCSS_FILES = [
    PREFIX_URL + '%s/angular-notify.min.css' % CSS_BASE,
    PREFIX_URL + '%s/bootstrap.min.css' % CSS_BASE,
    PREFIX_URL + '%s/vis.css' % CSS_BASE,
    PREFIX_URL + '%s/angular-material.min.css' % CSS_BASE,
    PREFIX_URL + '%s/font-awesome-4.7.0/css/font-awesome.min.css' % CSS_BASE,
    PREFIX_URL + '%s/hotgen.css' % CSS_BASE
]

HEAT_DASHBOARD_ROOT = heat_dashboard.__path__[0]

ADD_JS_FILES = discover_files(os.path.join(HEAT_DASHBOARD_ROOT, 'static'),
                              sub_path='%s/vendors' % JS_BASE,
                              ext='.js',
                              trim_base_path=True)
ADD_JS_FILES.extend([
    '%s/components/template-generator.module.js' % JS_BASE,
    '%s/components/utils.module.js' % JS_BASE,
    '%s/components/agent.module.js' % JS_BASE,
])

ADD_JS_FILES.extend([
    file
    for file in discover_files(os.path.join(HEAT_DASHBOARD_ROOT, 'static'),
                               sub_path='%s/components' % JS_BASE,
                               ext='.js',
                               trim_base_path=True)
    if file not in ADD_JS_FILES and 'spec.js' not in file
])
Пример #6
0
 def test_find_all_html(self):
     """Find all files with extension of `.html`
     """
     files = fd.discover_files(base_path, ext='.html')
     self.assertEqual(len(files), 2)
Пример #7
0
 def test_find_all_js(self):
     """Find all files with extension of `.js`
     """
     files = fd.discover_files(base_path, ext='.js')
     self.assertEqual(len(files), 14)
Пример #8
0
 def test_find_b(self):
     """Find all files in folder `b`
     """
     files = fd.discover_files(base_path, sub_path='b')
     self.assertEqual(len(files), 10)
Пример #9
0
 def test_find_all(self):
     """Find all files
     """
     files = fd.discover_files(base_path)
     self.assertEqual(len(files), 18)
Пример #10
0
 def test_find_all_html_in_a(self):
     """Find all files with extension of `.html` in folder a
     """
     files = fd.discover_files(base_path, sub_path='b', ext='.html')
     self.assertEqual(len(files), 1)
Пример #11
0
 def test_find_all_html_in_a(self):
     """Find all files with extension of `.html` in folder a"""
     files = fd.discover_files(base_path, sub_path='b', ext='.html')
     self.assertEqual(len(files), 1)
Пример #12
0
 def test_find_all_html(self):
     """Find all files with extension of `.html`"""
     files = fd.discover_files(base_path, ext='.html')
     self.assertEqual(len(files), 2)
Пример #13
0
 def test_find_all_js(self):
     """Find all files with extension of `.js`"""
     files = fd.discover_files(base_path, ext='.js')
     self.assertEqual(len(files), 14)
Пример #14
0
 def test_find_b(self):
     """Find all files in folder `b`"""
     files = fd.discover_files(base_path, sub_path='b')
     self.assertEqual(len(files), 10)
Пример #15
0
 def test_find_all(self):
     """Find all files"""
     files = fd.discover_files(base_path)
     self.assertEqual(len(files), 18)