You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

tests.py 617B

123456789101112131415161718
  1. import unittest
  2. from django.test import TestCase
  3. from oscar.core.loading import import_module, AppNotFoundError
  4. class ImportAppTests(unittest.TestCase):
  5. def test_a_specified_class_is_imported_correctly(self):
  6. module = import_module('product.models', ['Item'])
  7. self.assertEqual('oscar.apps.product.models', module.__name__)
  8. def test_unknown_apps_raise_exception(self):
  9. self.assertRaises(AppNotFoundError, import_module, 'banana', ['skin'])
  10. def test_no_classes_specified_raise_exception(self):
  11. self.assertRaises(ValueError, import_module, 'product.models')