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')
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")