Commits

Wayne Werner committed c98c347

Got edit task with project and desc passing

  • Participants
  • Parent commits e150d24

Comments (0)

Files changed (2)

     session.commit()
     return task
 
-def edit_task(id, desc=None, session=None):
+def edit_task(id, desc=None, project=None, type=None, status=None,
+        assigned_to=None, contact=None, priority=None, due=None,
+        original_estimate=None, current_estimate=None, version=None,
+        backlog_order=None, area=None, parent_case=None, session=None):
     '''Edit a task. Updating all values that are not None. If no task has that
     ID, then raise ValueError.
     '''
 
     if desc is not None:
         task.desc = desc
+    if project is not None:
+        task.project = project
+    if type is not None:
+        task.type = type
+    if status is not None:
+        raise ArgumentError()
+    if assigned_to is not None:
+        raise ArgumentError()
+    if contact is not None:
+        raise ArgumentError()
+    if priority is not None:
+        raise ArgumentError()
+    if due is not None:
+        raise ArgumentError()
+    if original_estimate is not None:
+        raise ArgumentError()
+    if current_estimate is not None:
+        raise ArgumentError()
+    if version is not None:
+        raise ArgumentError()
+    if backlog_order is not None:
+        raise ArgumentError()
+    if area is not None:
+        raise ArgumentError()
+    if parent_case is not None:
+        raise ArgumentError()
+
 
     session.add(task)
     session.commit()
         task = slayer.get_task(id)
         self.assertEqual(expected_desc, task.desc)
 
+    def test_whenEditTaskIsCalledWithProjectItShouldBeSet(self):
+        expected_proj = 'XTF-1234'
+        id = slayer.add_task(project='default').id
+        slayer.edit_task(id, project=expected_proj)
+        task = slayer.get_task(id)
+        self.assertEqual(expected_proj, task.project)
+
+    def test_whenEditTaskIsCalledWithTypeItShouldBeUpdated(self):
+        expected_type = 'Fnord'
+        id = slayer.add_task().id
+        slayer.edit_task(id, type=expected_type)
+        task = slayer.get_task(id)
+        self.assertEqual(expected_type, task.type)
+
 
     ##############
     # User Tests #