def tearDown(self): """ Drop each collection after each test. """ User.drop_collection() Organisation.drop_collection() Team.drop_collection() Project.drop_collection() Task.drop_collection() TaskList.drop_collection()
def test_0110_task_handler_get_3(self): """ Try to render a particular task with providing Task Id. If 'task id' is provided, then it will render a particular task. """ organisation = Organisation( name="open labs", slug=slugify("open labs") ) organisation.save() team = Team( name="Developers", organisation=organisation, members=[self.user] ) team.save() acl = AccessControlList(team=team, role="admin") project = Project( name="titan", organisation=organisation, acl=[acl], slug=slugify('titan project') ) project.save() tasklist = TaskList(name="version 01", project=project) tasklist.save() task = Task( title="testing", status="new", assigned_to=self.user, task_list=tasklist ) task.save() response = self.fetch( '/%s/%s/%s/tasks/%s' % ( organisation.slug, project.slug, tasklist.sequence, task.sequence ), method="GET", follow_redirects=False, headers={'Cookie': self.get_login_cookie()} ) self.assertEqual(response.code, 200)
def test_0130_create_task(self): """ Create Task under Task List """ organisation = Organisation( name="open labs", slug=slugify("open labs") ) organisation.save() project = create_project( self.user, 'Titan', 'titan project', organisation ) project.save() task_list = TaskList(name="Version 0.1", project=project) task_list.save() follow_up = FollowUp(message="Any message", from_status="resolved") # Create Task task = Task( title="Create model design", status ="resolved", assigned_to=self.user, watchers=[self.user], task_list=task_list, follow_ups=[follow_up] ) task.save() self.assertEqual(Task.objects().count(), 1)