def test_deleting_a_notebook_deletes_the_tasks(self): notebook = Notebook(name='tagada', users=[]) task = Task(notebook=notebook, name='stuff', periodicity=42) DBSession.add_all([notebook, task]) DBSession.flush() DBSession.delete(notebook) self.assertEqual(Task.query().count(), 0)
def test_deleting_a_task_deletes_the_executions(self): notebook = Notebook(name='tagada', users=[]) task = Task(notebook=notebook, name='stuff', periodicity=42) DBSession.add_all([notebook, task]) DBSession.flush() task.execute(None, 12) self.assertEqual(Execution.query().count(), 1) DBSession.delete(task) self.assertEqual(Execution.query().count(), 0)
def test_redirect_to_notebook_if_user_has_one_and_no_invites(self): user = User(email='*****@*****.**') notebook = Notebook(name='some notebook', users=[user]) DBSession.add_all([user, notebook]) DBSession.flush() self.assertEqual(Notebook.query().count(), 1) result = self._call_view(user=user) self.assertEqual(Notebook.query().count(), 1) self.assertEqual(result.code, 302) self.assertEqual(result.location, DummyRequest().resource_url(notebook))