def test_get_storage_by_module_name(self): """Storage: 'djangoflash.storage.cookie' should resolve to cookie flash storage. """ self.assertTrue(isinstance(flash_storage.get_storage('djangoflash.tests.storage'), FlashStorageClass))
def test_get_session_storage_by_relative_name(self): """Storage: 'session' should resolve to session flash storage. """ self.assertTrue(isinstance(flash_storage.get_storage('session'), \ session_storage.FlashStorageClass))
def test_get_cookie_storage_by_relative_name(self): """Storage: 'cookie' should resolve to cookie flash storage. """ self.assertTrue(isinstance(flash_storage.get_storage('cookie'), \ cookie_storage.FlashStorageClass))
def test_get_storage_by_invalid_module_name(self): """Storage: Should raise an error when resolving a module name that doesn't exists. """ operation = lambda: storage.get_storage('invalid.module.path') self.assertRaises(ImportError, operation)
def test_get_storage_by_invalid_module(self): """Storage: Should raise an error when module doesn't provide a storage class. """ operation = lambda: storage.get_storage('djangoflash.models') self.assertRaises(AttributeError, operation)
def test_get_cookie_storage_by_alias(self): """Storage: 'cookie' should resolve to cookie flash storage. """ storage_impl = storage.get_storage('cookie') self.assertTrue(isinstance(storage_impl, cookie.FlashStorageClass))
def test_get_storage_by_module_name(self): """Storage: 'djangoflash.storage.cookie' should resolve to cookie flash storage. """ storage_impl = storage.get_storage('djangoflash.storage.cookie') self.assertTrue(isinstance(storage_impl, cookie.FlashStorageClass))
def test_get_session_storage_by_alias(self): """Storage: 'session' should resolve to session flash storage. """ storage_impl = storage.get_storage('session') self.assertTrue(isinstance(storage_impl, session.FlashStorageClass))