def test_returned_variable(self): """ Assure get_variables returns variables unique to the context """ variables = get_variables(self._get_context({})) self.assertTrue('a' not in variables) variables = get_variables(self._get_context({'a': 3})) self.assertTrue('a' in variables)
def test_custom_processors(self): context = self._get_context({}, processors=[]) with context_context_manager(context): variables = get_variables(context) self.assertTrue("custom_processor_var" not in variables) context = self._get_context({}, processors=[test_processor]) with context_context_manager(context): variables = get_variables(context) self.assertTrue("custom_processor_var" in variables)
def test_custom_processors(self): context = self._get_context({}, processors=[]) with context_context_manager(context): variables = get_variables(context) self.assertTrue('custom_processor_var' not in variables) context = self._get_context({}, processors=[test_processor]) with context_context_manager(context): variables = get_variables(context) self.assertTrue('custom_processor_var' in variables)
def test_returned_variable(self): """Assure get_variables returns variables unique to the context.""" context = self._get_context({}) with context_context_manager(context): variables = get_variables(context) self.assertTrue("a" not in variables) context = self._get_context({"a": 3}) with context_context_manager(context): variables = get_variables(context) self.assertTrue("a" in variables)
def test_returned_variable(self): """Assure get_variables returns variables unique to the context.""" context = self._get_context({}) with context_context_manager(context): variables = get_variables(context) self.assertTrue('a' not in variables) context = self._get_context({'a': 3}) with context_context_manager(context): variables = get_variables(context) self.assertTrue('a' in variables)
def test_global_context_processors(self): """ Assure get_variables contains known global context processors such as request and user """ variables = set(get_variables(self._get_context())) self.assertTrue(variables.issuperset(set(self.known_globals)))
def test_global_context_processors(self): """ Assure get_variables contains known global context processors such as request and user """ context = self._get_context() with context_context_manager(context): variables = set(get_variables(context)) self.assertTrue(variables.issuperset(set(self.known_globals)))
def test_custom_processors(self): variables = get_variables(self._get_context({}, processors=[])) self.assertTrue('custom_processor_var' not in variables) variables = get_variables( self._get_context({}, processors=[test_processor])) self.assertTrue('custom_processor_var' in variables)