def test_multi_js_file(self): """Should handle an array of js file names""" files = ["js/test/libs/jasmine-djangojs.js", "js/test/libs/jasmine.js"] result = StorageGlobber.glob(files) self.assertIn(normpath("js/test/libs/jasmine-djangojs.js"), result) self.assertIn(normpath("js/test/libs/jasmine.js"), result)
def test_multi_js_file(self): '''Should handle an array of js file names''' files = ['js/test/libs/jasmine-djangojs.js', 'js/test/libs/jasmine.js'] result = StorageGlobber.glob(files) self.assertIn('js/test/libs/jasmine-djangojs.js', result) self.assertIn('js/test/libs/jasmine.js', result)
def get_context_data(self, **kwargs): context = super(JsTestView, self).get_context_data(**kwargs) context['js_test_files'] = StorageGlobber.glob(self.js_files) context['use_django_js'] = self.django_js context['use_query'] = self.jquery return context
def test_single_glob_expression(self): """Should handle a single glob pattern as js file list""" files = "js/test/libs/jasmine-*.js" result = StorageGlobber.glob(files) self.assertIn(normpath("js/test/libs/jasmine-djangojs.js"), result) self.assertIn(normpath("js/test/libs/jasmine-html.js"), result) self.assertIn(normpath("js/test/libs/jasmine-jquery.js"), result) self.assertNotIn(normpath("js/test/libs/jasmine.js"), result)
def test_single_glob_expression(self): '''Should handle a single glob pattern as js file list''' files = 'js/test/libs/jasmine-*.js' result = StorageGlobber.glob(files) self.assertIn('js/test/libs/jasmine-djangojs.js', result) self.assertIn('js/test/libs/jasmine-html.js', result) self.assertIn('js/test/libs/jasmine-jquery.js', result) self.assertNotIn('js/test/libs/jasmine.js', result)
def test_multi_glob_expression(self): '''Should handle a glob pattern list as js file list''' files = ['js/test/libs/jasmine-*.js', 'js/test/libs/qunit-*.js'] result = StorageGlobber.glob(files) self.assertIn('js/test/libs/jasmine-djangojs.js', result) self.assertIn('js/test/libs/jasmine-html.js', result) self.assertIn('js/test/libs/jasmine-jquery.js', result) self.assertIn('js/test/libs/qunit-tap.js', result) self.assertNotIn('js/test/libs/jasmine.js', result) self.assertNotIn('js/test/libs/qunit.js', result)
def test_multi_glob_expression(self): """Should handle a glob pattern list as js file list""" files = ["js/test/libs/jasmine-*.js", "js/test/libs/qunit-*.js"] result = StorageGlobber.glob(files) self.assertIn(normpath("js/test/libs/jasmine-djangojs.js"), result) self.assertIn(normpath("js/test/libs/jasmine-html.js"), result) self.assertIn(normpath("js/test/libs/jasmine-jquery.js"), result) self.assertIn(normpath("js/test/libs/qunit-tap.js"), result) self.assertNotIn(normpath("js/test/libs/jasmine.js"), result) self.assertNotIn(normpath("js/test/libs/qunit.js"), result)
def test_preserve_order(self): """Should preserve declaration order""" # Orders matters: should not be an alphabeticaly sorted list files = ["js/test/libs/jasmine.js", "js/djangojs/django.js", "js/test/libs/qunit-*.js"] result = StorageGlobber.glob(files) self.assertEqual(result[0], normpath("js/test/libs/jasmine.js")) self.assertEqual(result[1], normpath("js/djangojs/django.js")) for lib in result[2:]: self.assertIn(normpath("js/test/libs/qunit-"), lib) self.assertTrue(lib.endswith(".js"))
def test_preserve_order(self): '''Should preserve declaration order''' # Orders matters: should not be an alphabeticaly sorted list files = ['js/test/libs/jasmine.js', 'js/djangojs/django.js', 'js/test/libs/qunit-*.js'] result = StorageGlobber.glob(files) self.assertEqual(result[0], 'js/test/libs/jasmine.js') self.assertEqual(result[1], 'js/djangojs/django.js') for lib in result[2:]: self.assertIn('js/test/libs/qunit-', lib) self.assertTrue(lib.endswith('.js'))
def test_preserve_order(self): '''Should preserve declaration order''' # Orders matters: should not be an alphabeticaly sorted list files = [ 'js/test/libs/jasmine.js', 'js/djangojs/django.js', 'js/test/libs/qunit-*.js' ] result = StorageGlobber.glob(files) self.assertEqual(result[0], 'js/test/libs/jasmine.js') self.assertEqual(result[1], 'js/djangojs/django.js') for lib in result[2:]: self.assertIn('js/test/libs/qunit-', lib) self.assertTrue(lib.endswith('.js'))
def test_no_js_file(self): """Should handle empty js file list""" self.assertEqual(StorageGlobber.glob(), [])
def test_no_js_file(self): '''Should handle empty js file list''' # view = JsTestView() self.assertEqual(StorageGlobber.glob(), [])
def test_single_js_file(self): """Should handle a single js file name as string""" files = "js/test/libs/jasmine-djangojs.js" expected = [normpath("js/test/libs/jasmine-djangojs.js")] self.assertEqual(StorageGlobber.glob(files), expected)
def get_context_data(self, **kwargs): return { 'js_test_files': StorageGlobber.glob(self.js_files), 'use_query': self.jquery }
def test_single_js_file(self): '''Should handle a single js file name as string''' files = 'js/test/libs/jasmine-djangojs.js' expected = ['js/test/libs/jasmine-djangojs.js'] self.assertEqual(StorageGlobber.glob(files), expected)