def test_enabled(self): self.settings.enabled = True context = FauxContext() view = QueuePurge(context, FauxRequest) self.assertEqual('Queued', view()) self.assertEqual(1, len(self.handler.invocations)) self.assertTrue(self.handler.invocations[0].object is context)
def test_disabled(self): self.settings.enabled = False view = QueuePurge(FauxContext(), FauxRequest()) self.assertEqual('Caching not enabled', view()) self.assertEqual([], self.handler.invocations)