def test_incorrect_backend_path(self): settings = {BACKEND_SETTING_NAME: 'foo.bar.invalid.InvalidClass'} with self.settings(**settings): with self.assertRaises(ImproperlyConfigured): get_backend()
def test_correct_backend_returned(self): with self.settings(**DUMMY_BACKEND_SETTINGS): backend = get_backend() self.assertTrue(isinstance(backend, DummyBackend))
def test_missing_setting(self): with self.assertRaises(ImproperlyConfigured): get_backend()
def test_invalid_backend_path(self): settings = {BACKEND_SETTING_NAME: 'invalid'} with self.settings(**settings): with self.assertRaises(ImproperlyConfigured): get_backend()
def setUp(self): dummy_backend = get_backend() dummy_backend.flush()
def get_context_data(self, **kwargs): backend = user_streams.get_backend() stream = backend.filter_stream() return { 'object_list': stream.select_related('content_object, user, user__profile').all().order_by('-created_at') }