Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

settings_tests.py 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. from django.test import TestCase
  2. from django.template import loader, Context, TemplateDoesNotExist
  3. import oscar
  4. class TestOscarCoreAppsList(TestCase):
  5. def test_includes_oscar_itself(self):
  6. core_apps = oscar.OSCAR_CORE_APPS
  7. self.assertTrue('oscar' in core_apps)
  8. def test_can_be_retrieved_through_fn(self):
  9. core_apps = oscar.get_core_apps()
  10. self.assertTrue('oscar' in core_apps)
  11. def test_can_be_retrieved_with_overrides(self):
  12. apps = oscar.get_core_apps(overrides=['apps.shipping'])
  13. self.assertTrue('apps.shipping' in apps)
  14. self.assertTrue('oscar.apps.shipping' not in apps)
  15. def test_raises_exception_for_string_arg(self):
  16. with self.assertRaises(ValueError):
  17. oscar.get_core_apps('forks.catalogue')
  18. class TestOscarTemplateSettings(TestCase):
  19. """
  20. Oscar's OSCAR_MAIN_TEMPLATE_DIR setting
  21. """
  22. def test_allows_a_template_to_be_accessed_via_two_paths(self):
  23. paths = ['base.html', 'oscar/base.html']
  24. for path in paths:
  25. try:
  26. loader.get_template(path)
  27. except TemplateDoesNotExist:
  28. self.fail("Template %s should exist" % path)
  29. def test_allows_a_template_to_be_customized(self):
  30. path = 'base.html'
  31. template = loader.get_template(path)
  32. rendered_template = template.render(Context())
  33. self.assertIn('Oscar Test Shop', rendered_template)
  34. def test_default_oscar_templates_are_accessible(self):
  35. path = 'oscar/base.html'
  36. template = loader.get_template(path)
  37. rendered_template = template.render(Context())
  38. self.assertNotIn('Oscar Test Shop', rendered_template)