def test_preserve_anonymous_user(self): self._create_session('a-key') self._create_workflow('Workflow', session_key='a-key') sessions.delete_expired_sessions_and_workflows_sync() self.assertEqual(Workflow.objects.count(), 1)
def test_preserve_owner(self): owner = self._create_user('Alice') self._create_workflow('Workflow', owner=owner) sessions.delete_expired_sessions_and_workflows_sync() self.assertEqual(Workflow.objects.count(), 1)
def test_delete_expired_anonymous_user(self): self._create_session('a-key', timezone.now() - timedelta(0, 1)) self._create_workflow('Workflow', session_key='a-key') with self.assertLogs(sessions.__name__, logging.INFO): sessions.delete_expired_sessions_and_workflows_sync() self.assertEqual(Workflow.objects.count(), 0)