def test_0160_task_handler_post_5(self): """ Test TaskHandler 'post' method invalid form fields """ 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() response = self.fetch( '/%s/%s/%s/tasks/new' % ( organisation.slug, project.slug, tasklist.sequence ), method="POST", follow_redirects=False, body=urlencode({ "status": "new", "assigned_to": str(self.user.id), }), headers={'Cookie': self.get_login_cookie()}, ) self.assertEqual(response.code, 200)
def test_0100_task_handler_get_2(self): """ Try to render a particular task without providing Task Id If 'task id' is not provided, then it will return create task form. """ 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() response = self.fetch( '/%s/%s/%s/tasks/new' % ( organisation.slug, project.slug, tasklist.sequence ), method="GET", follow_redirects=False, headers={'Cookie': self.get_login_cookie()} ) self.assertEqual(response.code, 200)
def test_0090_task_handler_get_1(self): """ Try to render a particular task without being logged in """ 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() response = self.fetch( '/%s/%s/%s/tasks/new' % ( organisation.slug, project.slug, tasklist.sequence ), method="GET", follow_redirects=False, ) self.assertEqual(response.code, 302)
def test_0080_tasklist_get_1(self): """ Test Task List with wrong organisation slug """ 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() response = self.fetch( '/wrong-organisation/%s/%s' % (project.slug, tasklist.sequence), method="GET", follow_redirects=False, headers={'Cookie': self.get_login_cookie()} ) self.assertEqual(response.code, 404)
def test_0110_create_tasklist(self): """ Create task list under project """ 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() self.assertEqual(TaskList.objects().count(), 1)
def test_0140_task_required_fields(self): """ Test the fields required for the Task collection. """ 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") #"title" is a required field task = Task( status ="resolved", assigned_to=self.user, watchers=[self.user], task_list=task_list, follow_ups=[follow_up] ) self.assertRaises(ValidationError, task.save) # "Status" is a required Field task = Task( title="Create model design", assigned_to=self.user, watchers=[self.user], task_list=task_list, follow_ups=[follow_up] ) self.assertRaises(ValidationError, task.save) # "assigned_to" is a required field task = Task( title="Create model desi", status ="resolved", watchers=[self.user], task_list=task_list, follow_ups=[follow_up] ) self.assertRaises(ValidationError, task.save) # "task_list" is a required field task = Task( title="Create model design", status ="resolved", assigned_to=self.user, ) self.assertRaises(ValidationError, task.save)
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)