Пример #1
0
        def testing(filesystem_loader, app_directories_loader):
            filesystem_loader.side_effect = TemplateDoesNotExist('error')
            app_directories_loader.side_effect = TemplateDoesNotExist('error')

            from django_mobile.loader import Loader
            loader = Loader(get_engine())

            set_flavour('mobile')
            try:
                loader.load_template_source('base.html', template_dirs=None)
            except TemplateDoesNotExist:
                pass
            self.assertEqual(filesystem_loader.call_args[0][0],
                             'mobile/base.html')
            self.assertEqual(app_directories_loader.call_args[0][0],
                             'mobile/base.html')

            set_flavour('full')
            try:
                loader.load_template_source('base.html', template_dirs=None)
            except TemplateDoesNotExist:
                pass
            self.assertEqual(filesystem_loader.call_args[0][0],
                             'full/base.html')
            self.assertEqual(app_directories_loader.call_args[0][0],
                             'full/base.html')
Пример #2
0
        def testing(filesystem_loader, app_directories_loader):
            filesystem_loader.return_value = []
            app_directories_loader.return_value = []

            from django_mobile.loader import Loader
            loader = Loader(get_engine())

            set_flavour('mobile')
            try:
                loader.get_template('base.html')
            except TemplateDoesNotExist:
                pass
            self.assertEqual(filesystem_loader.call_args[0][0],
                             'mobile/base.html')
            self.assertEqual(app_directories_loader.call_args[0][0],
                             'mobile/base.html')

            set_flavour('full')
            try:
                loader.get_template('base.html')
            except TemplateDoesNotExist:
                pass
            self.assertEqual(filesystem_loader.call_args[0][0],
                             'full/base.html')
            self.assertEqual(app_directories_loader.call_args[0][0],
                             'full/base.html')
Пример #3
0
        def testing(filesystem_loader, app_directories_loader):
            filesystem_loader.side_effect = TemplateDoesNotExist()
            app_directories_loader.side_effect = TemplateDoesNotExist()

            from django_mobile.loader import Loader
            loader = Loader(get_engine())

            set_flavour('mobile')
            try:
                loader.load_template('base.html', template_dirs=None)
            except TemplateDoesNotExist:
                pass
            self.assertEqual(filesystem_loader.call_args[0][0], 'mobile/base.html')
            self.assertEqual(app_directories_loader.call_args[0][0], 'mobile/base.html')

            set_flavour('full')
            try:
                loader.load_template('base.html', template_dirs=None)
            except TemplateDoesNotExist:
                pass
            self.assertEqual(filesystem_loader.call_args[0][0], 'full/base.html')
            self.assertEqual(app_directories_loader.call_args[0][0], 'full/base.html')
Пример #4
0
        def testing(filesystem_loader, app_directories_loader):
            filesystem_loader.side_effect = TemplateDoesNotExist("error")
            app_directories_loader.side_effect = TemplateDoesNotExist("error")

            from django_mobile.loader import Loader

            loader = Loader(get_engine())

            set_flavour("mobile")
            try:
                loader.get_template("base.html")
            except TemplateDoesNotExist:
                pass
            self.assertEqual(filesystem_loader.call_args[0][0], "mobile/base.html")
            self.assertEqual(app_directories_loader.call_args[0][0], "mobile/base.html")

            set_flavour("full")
            try:
                loader.get_template("base.html")
            except TemplateDoesNotExist:
                pass
            self.assertEqual(filesystem_loader.call_args[0][0], "full/base.html")
            self.assertEqual(app_directories_loader.call_args[0][0], "full/base.html")