Пример #1
0
 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))
Пример #2
0
 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))
Пример #3
0
 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))
Пример #4
0
 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)
Пример #5
0
 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)
Пример #6
0
 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))
Пример #7
0
 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))
Пример #8
0
 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))
Пример #9
0
 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)
Пример #10
0
 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)
Пример #11
0
 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))
Пример #12
0
 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))