Commits

Wayne Werner  committed a7c9004

Cleaned out tests to start out simple.

  • Participants
  • Parent commits f15e31b
  • Branches simple

Comments (0)

Files changed (2)

 def make_parser():
     '''Generates the ArgumentParser to parse Boog Slayer arguments.'''
 
-class User(Base):
-    __tablename__ = 'users'
-
-    id = Column(String, primary_key=True)
-    name = Column(String)
-    timesheet = relationship('Interval',
-                             backref=backref('user',
-                                             order_by='Interval.start'))
-
-    def __repr__(self):
-        return "User <id={0}, name={1}>".format(self.id, self.name)
-
-    def __eq__(self, other):
-        try:
-            return self.id == other.id and self.name == other.name
-        except AttributeError:
-            return False
-
 class Project(Base):
     __tablename__ = 'projects'
 
         except AttributeError:
             return False
 
+class Task(Base):
+    __tablename__ = 'tasks'
+
+    id = Column(Integer, primary_key=True)
+    desc = Column(String)
+    project = Column(String, ForeignKey('projects.name'))
+
 class Interval(Base):
     __tablename__ = "intervals"
 
     start = Column(DateTime, primary_key=True)
     end = Column(DateTime)
     task_id = Column(Integer, ForeignKey('tasks.id'))
-    user_id = Column(String, ForeignKey('users.id'), primary_key=True)
-
-    def __init__(self, task_id, user_id, start=None, end=None):
-        if start is None:
-            start  = datetime.now()
-        self.start = start
-        self.end = end
-        self.task_id = task_id
-        self.user_id = user_id
-
-    def __eq__(self, other):
-        try:
-            return (self.start == other.start
-                    and self.end == other.end
-                    and self.task_id == other.task_id
-                    and self.user_id == other.user_id)
-        except AttributeError:
-            return False
-    
-    def __repr__(self):
-        return 'Interval <start={0}, end={1}, user={2}, task={3}>'.format(
-                self.start, self.end, self.user_id, self.task_id)
-
-class Task(Base):
-    __tablename__ = 'tasks'
-
-    id = Column(Integer, primary_key=True)
-    desc = Column(String)
-    project = Column(String, ForeignKey('projects.name'))
-    type = Column(String)
-    status = Column(String)
-    assigned_to = Column(String, ForeignKey('users.id'))
-    contact = Column(String)
-    priority = Column(Integer)
-    due = Column(DateTime)
-    original_estimate = Column(Integer)
-    current_estimate = Column(Integer)
-    version = Column(String)
-    backlog_order = Column(Integer)
-    area = Column(String)
-    parent_case = Column(Integer, ForeignKey('tasks.id'))
+    user_id = Column(String)
 
 def make_engine():
     engine = create_engine('sqlite:///{0}'.format(DB_PATH))
     Base.metadata.drop_all(engine, checkfirst=True)
     make_db(engine)    
 
-def edit_user(user_id, new_id=None, new_name=None, session=None):
-    '''Edit a user, changing their ID and/or name. If user with original ID
-    does not exist, raise ValueError.
-
-    '''
-
+def add_project(name=None, session=None):
     if session is None:
         session = make_session()
-
-    user = session.query(User).filter_by(id=user_id).first()
-    if user is None:
-        raise ValueError("No user with id <{0}>".format(user_id))
-    
-    changed = new_id is not None or new_name is not None
-
-    if new_id is not None:
-        user.id = new_id
-
-    if new_name is not None:
-        user.name = new_name
-
-    if changed:
-        session.add(user)
-        try:
-            session.commit()
-        except sqlalchemy.exc.IntegrityError:
-            raise ValueError("User with id <{0}> already exists.".format(new_id))
-
-    return user
-
-def delete_user(user_id, session=None):
-    '''Delete user with provided user_id. If user does not exist, raise
-    ValueError
-    '''
-
-    if session is None:
-        session = make_session()
-    user = session.query(User).filter_by(id=user_id).first()
-    if user is None:
-        raise ValueError("User with id <{0}> does not exist.".format(user_id))
-    session.delete(user)
+    name = '' if name is None else name
+    proj = Project(name=name)
+    session.add(proj)
     session.commit()
 
-def add_user(user_id='', name='', session=None):
-    '''Add a user to Boog Slayer.'''
-    if session is None:
-        session = make_session()
-    user = User(id=user_id, name=name)
-    session.add(user)
-    session.commit()
-    return user
-
-def add_project(project_name='', session=None):
-    '''Add a new project to Boog Slayer. If the project ID already exists then
-    raise ValueError.
-    '''
-
-    if session is None:
-        session = make_session()
-    project = Project(name=project_name)
-    session.add(project)
-    try:
-        session.commit()
-    except sqlalchemy.exc.IntegrityError:
-        raise ValueError("Project already exists"
-                         " with name <{0}>".format(project_name))
-    return project
-
-def get_project(project_name, session=None):
-    '''Return the project with the given name. If project does not exist, then
-    return None.
-    '''
-
-    if session is None:
-        session = make_session()
-    return session.query(Project).filter_by(name=project_name).first()
-
-def edit_project(project_name, new_name=None, new_desc=None, session=None):
-    '''Edit a project, updating its name and/or description. If the new project
-    name already exists, raise ValueError. Also raise ValueError if no project
-    has the provided name.
-    '''
-    if session is None:
-        session = make_session()
-
-    project = session.query(Project).filter_by(name=project_name).first()
-    if project is None:
-        raise ValueError("No project exists with name <{0}>".format(project_name))
-
-    if new_name is not None:
-        project.name = new_name
-
-    if new_desc is not None:
-        project.desc = new_desc
-
-    session.add(project)
-    try:
-        session.commit()
-    except sqlalchemy.exc.IntegrityError:
-        raise ValueError("Project with name <{0}> already"
-                         " exists".format(project_name))
-
-def restore_project(project_name, session=None):
-    '''Restore a project by setting archived to False. If project does not
-    exist, raise ValueError.'''
-
-    if session is None:
-        session = make_session()
-    project = session.query(Project).filter_by(name=project_name).first()
-    if project is None:
-        raise ValueError("No project exists with name <{0}>".format(project_name))
-    project.archived = False
-    session.add(project)
-    session.commit()
-
-def archive_project(project_name, session=None):
-    '''Set archived to True on project given by the project_name. If project 
-    does not exist, raise ValueError.
-    '''
-
-    if session is None:
-        session = make_session()
-    project = session.query(Project).filter_by(name=project_name).first()
-    if project is None:
-        raise ValueError("No project exists with name <{0}>".format(project_name))
-
-    project.archived = True
-    session.add(project)
-    session.commit()
-
-
-def get_user(user_id='', session=None):
-    '''Get a user with the provided user_id. If the user does not exist,
-    return None.
-
-    '''
-    if session is None:
-        session = make_session()
-    user = session.query(User).filter_by(id=user_id).first()
-    return user
-
-def add_task(desc=None, project=None, assigned_to=None, parent_id=None,
-             session=None):
-    '''Add a task to Boog Slayer.'''
-    if session is None:
-        session = make_session()
-
-    if parent_id is not None:
-        parent_task = session.query(Task).filter_by(id=parent_id).first()
-        if parent_task is None:
-            raise ValueError("No task with id <{0}>".format(parent_id))
-
-    if assigned_to is not None:
-        user = session.query(User).filter_by(name=assigned_to).first()
-        if user is None:
-            raise ValueError("No user with <{0}>".format(user))
-
-    if project is not None:
-        proj = session.query(Project).filter_by(name=project).first()
-        if proj is None:
-            raise ValueError("No project with <{0}>".format(project))
-
-    task = Task(desc=desc,
-                project=project)
-    session.add(task)
-    session.commit()
-    return task
-
-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 session is None:
-        session = make_session()
-
-    task = session.query(Task).filter_by(id=id).first()
-    if task is None:
-        raise ValueError('No task exists with id <{0}>'.format(id))
-
-    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:
-        task.status = status
-    if assigned_to is not None:
-        task.assigned_to = assigned_to
-    if contact is not None:
-        task.contact = contact
-    if priority is not None:
-        task.priority = priority
-    if due is not None:
-        task.due = due
-    if original_estimate is not None:
-        task.original_estimate = original_estimate
-    if current_estimate is not None:
-       task.current_estimate = current_estimate
-    if version is not None:
-        task.version = version
-    if backlog_order is not None:
-        task.backlog_order = backlog_order
-    if area is not None:
-        task.area = area
-    if parent_case is not None:
-        parent = session.query(Task).filter_by(id=parent_case).first()
-        if parent is None:
-            raise ValueError("parent_case id <{}> does not exist.".format(parent_case))
-        task.parent_case = parent_case
-
-
-    session.add(task)
-    session.commit()
-
-def get_task(task_id, session=None):
-    '''Return the task with the given task_id. If the task does not exist,
-    return None instead.
-
-    '''
-    if session is None:
-        session = make_session()
-    task = session.query(Task).filter_by(id=task_id).first()
-    return task
-
-def _parse(argv):
-    parser = argparse.ArgumentParser(description="Boog Slayer")
-    parser.add_argument('--mode',
-                        type=str,
-                        choices=['html', 'json'],
-                        default='json',
-                       )
-
-    subparser = parser.add_subparsers(dest='command')
-    interval_parser = subparser.add_parser('task')
-    interval_parser.add_argument('action',
-                                 type=str,
-                                 choices=['start',
-                                          'stop',
-                                          'list',
-                                          'complete',
-                                         ]
-                                 )
-    interval_parser.add_argument('data',
-                                 type=str,
-                                 help='Task ID or Description',
-                                 default=None,
-                                 )
-
-    result = parser.parse_args(argv)
-    return result
-
-def start_interval(task_id, user_id, session=None):
-    '''Start a new worksheet interval on the Task with the given task_id,
-    for the User with the given user_id.
-
-    If the Task or User does not exist, raise a ValueError.
-    '''
-    if session is None:
-        session = make_session()
-    task = session.query(Task).filter_by(id=task_id).first()
-    if task is None:
-        raise ValueError("Task with ID <{0}> does not exist.".format(task_id))
-    user = session.query(User).filter_by(id=user_id).first()
-    if user is None:
-        raise ValueError("User with ID <{0}> does not exist.".format(user_id))
-    interval = Interval(task_id=task_id, user_id=user_id)
-    session.add(interval)
-    session.commit()
-    return interval
-
-def main(argv):
-    results = _parse(argv)
-    print(results)
+def main(args):
+    return args
 
 if __name__ == "__main__":
-    main(['task', 'start', 'Do all things'])
-    #main(sys.argv[1:])
+    print(main(sys.argv[1:]))
 from datetime import datetime
 
 @contextlib.contextmanager
-def new_thing(func, session=None, *args, **kwargs):
-    if session is None:
-        session = slayer.make_session()
-    try:
-        kwargs['session'] = session
-        thing = func(*args, **kwargs)
-        yield thing
-    except Exception as e:
-        raise e
-    session.delete(thing)
-    session.commit()
-
-@contextlib.contextmanager
-def new_task(*args, **kwargs):
-    try:
-        with new_thing(slayer.add_task, *args, **kwargs) as task:
-            yield task
-    except Exception as e:
-        raise e
-
-@contextlib.contextmanager
-def new_user(*args, **kwargs):
-    try:
-        with new_thing(slayer.add_user, *args, **kwargs) as user:
-            yield user
-    except Exception as e:
-        raise e
-
-@contextlib.contextmanager
-def new_project(*args, **kwargs):
-    try:
-        with new_thing(slayer.add_project, *args, **kwargs) as project:
-            yield project
-    except Exception as e:
-        raise e
-
-@contextlib.contextmanager
-def new_session():
-    try:
-        session = slayer.make_session()
-        yield session
-        session.commit()
-    except Exception as e:
-        session.rollback()
-        raise e
-    finally:
-        session.close()
-
-@contextlib.contextmanager
 def test_database():
-    global SESSION
     try:
         slayer.DB_PATH = os.path.join(slayer.BASE_DIR, 'test.sq3')
         slayer.make_db()
         os.remove(slayer.DB_PATH)
         raise(e)
 
+class SlayerTests(unittest.TestCase):
+    def __init__(self, *args, **kwargs):
+        super(SlayerTests, self).__init__(*args, **kwargs)
+        self.engine = slayer.make_engine()
+        self.session = slayer.make_session(self.engine)
 
-class TaskTest(unittest.TestCase):
-    def test_whenTaskIsCreatedWithDescItShouldBeSet(self):
-        task = slayer.Task(desc="Nothing happened...")
-        self.assertEqual("Nothing happened...", task.desc)
+    def testWhenAddProjectIsCalledWithNoProjectNameItShouldBeBlank(self):
+        slayer.add_project(name=None, session=self.session)
+        proj = self.session.query(slayer.Project).filter_by(name='').first()
+        self.assertIsNotNone(proj)
+        self.assertEqual('', proj.name)
 
-    def test_whenTaskIsCreatedWithNoIdItShouldBeNone(self):
-        task = slayer.Task()
-        self.assertEqual(None, task.id)
+    def testWhenAddProjectIsCalledWithProjectNameItShouldBeSet(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithNoDescItShouldBeNone(self):
-        task = slayer.Task()
-        self.assertEqual(None, task.desc)
+    def testWhenAddProjectIsCalledWithNoDescriptionItShouldBeBlank(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedAndIdAlreadyExistsItShouldValueError(self):
-        self.skipTest("Write this test")
+    def testWhenAddProjectIsCalledWithDescriptionItShouldBeSet(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedAndIdDoesNotExistItShouldBeSet(self):
-        self.skipTest("Write this test")
+    def testWhenAddProjectIsCalledWithDuplicateProjectNameItShouldValueError(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithoutProjectItShouldBeDefault(self):
-        self.skipTest("Write this test")
+    def testWhenUpdateProjectIsCalledWithDescriptionItShouldUpdate(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithProjectThatDoesNotExistItShouldValueError(self):
-        self.skipTest("Write this test")
+    def testWhenUpdateProjectIsCalledWithArchiveItShouldSet(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithProjectThatExistsItShouldBeSet(self):
-        self.skipTest("Write this test")
+    def testWhenUpdateProjectIsCalledWithNameItShouldUpdate(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithNoTypeItShouldBeNone(self):
-        self.skipTest("Write this test")
+    def testWhenUpdateProjectIsCalledWithDuplicateNameItShouldValueError(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithTypeItShouldBeSet(self):
-        self.skipTest("Write this test")
+    def testWhenAddTaskIsCalledWithBadProjectNameItShouldValueError(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithNoStatusItShouldBeNone(self):
-        self.skipTest("Write this test")
+    def testWhenAddTaskIsCalledWithGoodProjectNameItShouldBeSet(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithStatusItShouldBeSet(self):
-        self.skipTest("Write this test")
+    def testWhenAddTaskIsCalledItShouldSetTheId(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithNoAssignedToItShouldBeNone(self):
-        self.skipTest("Write this test")
+    def testWhenAddTaskIsCalledWithTaskDescItShouldBeSet(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithAssignedToAndUserDoesNotExistItShouldValueError(self):
-        self.skipTest("Write this test")
+    def testWhenAddTaskIsCalledWithNoTaskDescItShouldBeBlank(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithAssignedToAdnUserExistsItShouldBeSet(self):
-        self.skipTest("Write this test")
+    def testWhenUpdateTaskIsCalledWithGoodProjectNameItShouldBeSet(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithContactItShouldBeSet(self):
-        self.skipTest("Write this test")
+    def testWhenUpdateTaskIsCalledWithBadProjectNameItShouldValueError(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithNoContactItShouldBeNone(self):
-        self.skipTest("Write this test")
+    def testWhenUpdateTaskIsCalledWithDescriptionItShouldBeSet(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithNoPriorityItShouldBeNone(self):
-        self.skipTest("Write this test")
+    def testWhenAddIntervalIsCalledWithBadTaskIdItShouldValueError(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithPriorityItShouldBeSet(self):
-        self.skipTest("Write this test")
+    def testWhenAddIntervalIsCalledWithGoodTaskAndNoUserIdItShouldBeBlank(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithNoDueDateItShouldBeNone(self):
-        self.skipTest("Write this test")
+    def testWhenAddIntervalIsCalledWithGoodTaskAndUserIdItShouldBeSet(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithDueDateItShouldBeSet(self):
-        self.skipTest("Write this test")
+    def testWhenGetIntervalIsCalledWithOnlyUserItShouldReturnOpenInterval(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithNoOriginalEstimateItShouldBeNone(self):
-        self.skipTest("Write this test")
+    def testWhenGetIntervalIsCalledAndNoIntervalExistsForUserItShouldBeNone(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithOriginalEstimateItShouldBeSet(self):
-        self.skipTest("Write this test")
+    def testWhenStopIntervalIsCalledAndNoOpenIntervalItShouldValueError(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithNoCurrentEstimateItShouldBeNone(self):
-        self.skipTest("Write this test")
+    def testWhenStopIntervalIsCalledAndOpenIntervalExistsItShouldCloseIt(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithCurrentEstimateItShouldBeSet(self):
-        self.skipTest("Write this test")
+    def testWhenAddIntervalIsCalledAndOpenOneExistsItShouldCloseIt(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithCurrentEstimateAndNoOriginalOriginalShouldBeSet(self):
-        self.skipTest("Write this test")
+    def testWhenAddIntervalIsCalledWithStartTimeItShouldBeSet(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithNoVersionItShouldBeNone(self):
-        self.skipTest("Write this test")
+    def testWhenAddIntervalIsCalledWithEndTimeItShouldBeSet(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithVersionItShouldBeSet(self):
-        self.skipTest("Write this test")
+    def testWhenAddIntervalIsCalledWithNoStartTimeItShouldBeNow(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithNoBacklogOrderItShouldBeNone(self):
-        self.skipTest("Write this test")
+    def testWhenAddIntervalIsCalledWithNoEndTimeItShouldBeNone(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithBacklogOrderItShouldBeSet(self):
-        self.skipTest("Write this test")
+    def testWhenAddIntervalIsCalledAndTimeMatchesItShouldDoNothing(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithNoAreaItShouldBeNone(self):
-        self.skipTest("Write this test")
+    def testWhenAddIntervalIsCalledAndTimeJoinsTwoItShouldMerge(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithAreaItShouldBeSet(self):
-        self.skipTest("Write this test")
+    def testWhenAddIntervalIsCalledAndItEndsInAnotherOfSameTaskItShouldMerge(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithNoParentCaseItShouldBeNone(self):
-        self.skipTest("Write this test")
+    def testWhenAddIntervalIsCalledAndItEndsInDifferentTaskItShouldAdjustOther(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithBadParentCaseItShouldValueError(self):
-        self.skipTest("Write this test")
+    def testWhenAddIntervalSplitsOtherTaskThereShouldNowBeThree(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenTaskIsCreatedWithGoodParentCaseItShouldBeSet(self):
-        self.skipTest("Write this test")
+    def testWhenAddIntervalStartsInOtherTaskItShouldAdjust(self):
+        self.skipTest("TODO: Write me")
 
-class IntervalTests(unittest.TestCase):
-    def test_whenIntervalIsCreatedWithNoStartItShouldBeNow(self):
-        interval = slayer.Interval(1, 'uwwerne')
-        self.assertAlmostEqual(datetime.now().toordinal(),
-                               interval.start.toordinal(), places=0)
+    def testWhenGetWorkIsCalledForUserItShouldReturnAllIntervals(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenIntervalIsCreatedWithStartItShouldBeTheProvidedOne(self):
-        expected_start = datetime.now()
-        interval = slayer.Interval(1, 'uwwerne', start=expected_start)
-        self.assertAlmostEqual(expected_start, interval.start, places=2)
+    def testWhenGetWorkIsCalledWithStartAndUserItShouldReturnAllAfterStart(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenIntervalIsCreatedWithNoEndItShouldBeNone(self):
-        interval = slayer.Interval(1, 'wayne')
-        self.assertEqual(None, interval.end)
+    def testWhenGetWorkIsCalledWithEndItShouldReturnWorkBeforeEnd(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenIntervalIsCreatedWithEndItShouldBeTheProvidedOne(self):
-        expected_end = time.time()-42
-        interval = slayer.Interval(3, 'wayne', end=expected_end)
-        self.assertEqual(expected_end, interval.end)
+    def testWhenGetWorkIsCalledWithRangeItShouldReturnWorkInRange(self):
+        self.skipTest("TODO: Write me")
 
-class SlayerTests(unittest.TestCase):
-    #@classmethod
-    #def setUpClass(cls):
-    #    slayer.DB_PATH = os.path.join(slayer.BASE_DIR, 'test.sq3')
-    #    slayer.make_db()
-    #    SlayerTests.session = slayer.make_session()
-#
-#    @classmethod
-#    def tearDownClass(cls):
-#        os.remove(slayer.DB_PATH)
-#
-#    def setUp(self):
-#        slayer.add_project(project_name='default')
-#
-#    def tearDown(self):
-        #engine = slayer.make_engine()
-        #with contextlib.closing(engine.connect()) as con:
-        #    trans = con.begin()
-        #    for table in reversed(slayer.Base.metadata.sorted_tables):
-        #        con.execute(table.delete())
-        #    trans.commit()
-#        ''
+    def testWhenGetWorkIsCalledWithRangeAndUserItShouldFilter(self):
+        self.skipTest("TODO: Write me")
 
-    def test_whenParseIsCalledWithNoArgsItShouldRaiseSystemExit(self):
-        with self.assertRaises(SystemExit):
-            slayer._parse([])
-
-    def test_whenParseIsCalledWithTaskStartAndNoDescShouldSystemExit(self):
-        with self.assertRaises(SystemExit):
-            slayer._parse(['task', 'start'])
-
-    def test_whenParseIsCalledWithTaskStartAndDescShouldReturnResults(self):
-        results = slayer._parse(['task', 'start', 'Rock me amadaeus'])
-        expected_command = 'task'
-        expected_action = 'start'
-        expected_data = 'Rock me amadaeus'
-
-        self.assertEqual(expected_command, results.command)
-        self.assertEqual(expected_action, results.action)
-        self.assertEqual(expected_data, results.data)
-
-    ##################
-    # Interval Tests #
-    ##################
-    def test_whenStartIntervalIsCalledTaskDoesNotExistItShouldRaiseValueError(self):
-        self.skipTest('fixme')
-        with self.assertRaises(ValueError):
-            slayer.start_interval(task_id=4, user_id='wango',
-                    session=self.session)
-
-    def test_whenStartIntervalIsCalledAndUserDNEThenItShouldValueError(self):
-        with new_task(project='default') as task:
-            with self.assertRaises(ValueError):
-                slayer.start_interval(task_id=task.id, user_id='wango')
-                    
-
-    def test_whenStartIntervalIsCalledAndTaskAndUserExistItShouldBeAddedToUser(self):
-        self.skipTest('fixme')
-        with new_user() as user, new_task(project='default') as task:
-            interval = slayer.start_interval(task_id=task.id, user_id=user.id,
-                                             session=session)
-            user = slayer.get_user(user.id, session)
-            self.assertEqual(interval, user.timesheet[0])
-
-    def test_whenStartIntervalIsCalledOkItShouldReturnTheInterval(self):
-        self.skipTest('fixme')
-        user_id = slayer.add_user().id
-        task_id = slayer.add_task(project='default').id
-        interval = slayer.start_interval(task_id=task_id, user_id=user_id,
-                session=self.session)
-        self.assertTrue(isinstance(interval, slayer.Interval))
-
-    ##############
-    # Task Tests #
-    ##############
-    def test_whenAddTaskIsCalledItShouldReturnTheTaskWithNewId(self):
-        with new_task(project='default') as task:
-            self.assertLess(0, task.id)
-
-    def test_whenAddTaskIsCalledWithDescItShouldBeSet(self):
-        expected_desc = 'No real project thing'
-        with new_task(desc=expected_desc, project='default') as task:
-            self.assertEqual(expected_desc, slayer.get_task(task.id).desc)
-
-    def test_whenAddTaskIsCalledWithProjectThatExistsItShouldBeSet(self):
-        expected_proj = 'Boog-eriffic'
-        with new_project(project_name=expected_proj) as proj, \
-                new_task(project=expected_proj) as task:
-            task = slayer.get_task(task.id)
-            self.assertEqual(expected_proj, task.project)
-
-    def test_whenAddTaskIsCalledWithProjectAndProjectDoesNotExistShouldRaiseValueError(self):
-        expected_proj = 'Did anyone make this?'
-        with self.assertRaises(ValueError):
-            slayer.add_task(project=expected_proj)
-
-    def test_whenAddTaskIsCalledWithUserAndUserDoesNotExistShouldRaiseValueError(self):
-        imaginary_user = 'some super cool id'
-        with self.assertRaises(ValueError):
-            slayer.add_task(assigned_to=imaginary_user)
-
-    def test_whenAddTaskIsCalledWithParentCaseThatDoesntExistItShouldRaiseValueError(self):
-        imaginary_task_id = 42
-        with self.assertRaises(ValueError):
-            slayer.add_task(parent_id=imaginary_task_id)
-
-    def test_whenGetTaskIsCalledWithIdItShouldReturnTask(self):
-        with new_task(project='default') as task:
-            task_id = task.id
-            task = slayer.get_task(task_id=task.id)
-            self.assertEqual(task_id, task.id)
-
-    def test_whenEditTaskIsCalledWithInvalidIdItShouldRaiseValueError(self):
-        with self.assertRaises(ValueError):
-            slayer.edit_task(id=42)
-
-    def test_whenEditTaskIsCalledWithDescItShouldBeSet(self):
-        expected_desc = 'No real project thing'
-        with new_task(project='default') as task:
-            slayer.edit_task(task.id, desc=expected_desc)
-            self.assertEqual(expected_desc, slayer.get_task(task.id).desc)
-
-    def test_whenEditTaskIsCalledWithProjectItShouldBeSet(self):
-        expected_proj = 'XTF-1234'
-        with new_task(project='default') as task:
-            slayer.edit_task(task.id, project=expected_proj)
-            task = slayer.get_task(task.id)
-            self.assertEqual(expected_proj, task.project)
-
-    def test_whenEditTaskIsCalledWithTypeItShouldBeUpdated(self):
-        expected_type = 'Fnord'
-        with new_task(project='default') as task:
-            slayer.edit_task(task.id, type=expected_type)
-            task = slayer.get_task(task.id)
-            self.assertEqual(expected_type, task.type)
-
-    def test_whenEditTaskIsCalledWithStatusItShouldBeUpdated(self):
-        self.skipTest('fixme')
-        expected_status = 'Newed'
-        id = slayer.add_task(session=self.session).id
-        slayer.edit_task(id, status=expected_status, session=self.session)
-        task = slayer.get_task(id, session=self.session)
-        self.assertEqual(expected_status, task.status)
-
-    def test_whenEditTaskIsCalledWithAssignedToItShouldBeUpdated(self):
-        self.skipTest('fixme')
-        expected_assigned_to = 'Puff, the magic dragon'
-        id = slayer.add_task(session=self.session).id
-        slayer.edit_task(id, assigned_to=expected_assigned_to,
-                session=self.session)
-        task = slayer.get_task(id, session=self.session)
-        self.assertEqual(expected_assigned_to, task.assigned_to)
-
-    def test_whenEditTaskIsCalledWithContactItShouldBeUpdated(self):
-        self.skipTest('fixme')
-        expected_contact = '3-2-1'
-        id = slayer.add_task().id
-        slayer.edit_task(id, contact=expected_contact, session=self.session)
-        task = slayer.get_task(id, session=self.session)
-        self.assertEqual(expected_contact, task.contact)
-
-    def test_whenEditTaskIsCalledWithPriorityItShouldBeUpdated(self):
-        self.skipTest('fixme')
-        expected_priority = 1
-        id = slayer.add_task().id
-        slayer.edit_task(id, priority=expected_priority, session=self.session)
-        task = slayer.get_task(id, session=self.session)
-        self.assertEqual(expected_priority, task.priority)
-
-    def test_whenEditTaskIsCalledWithDueItShouldBeUpdated(self):
-        self.skipTest('fixme')
-        expected_due = datetime(1984, 8, 26)
-        id = slayer.add_task().id
-        slayer.edit_task(id, due=expected_due, session=self.session)
-        task = slayer.get_task(id, session=self.session)
-        self.assertEqual(expected_due, task.due)
-
-    def test_whenEditTaskIsCalledWithOriginalEstimateItShouldBeUpdated(self):
-        self.skipTest('fixme')
-        expected_original_estimate = 13
-        id = slayer.add_task(session=self.session).id
-        slayer.edit_task(id, original_estimate=expected_original_estimate,
-                session=self.session)
-        task = slayer.get_task(id, session=self.session)
-        self.assertEqual(expected_original_estimate, task.original_estimate)
-
-    def test_whenEditTaskIsCalledWithCurrentEstimateItShouldBeUpdated(self):
-        self.skipTest('fixme')
-        expected_current_estimate = 13
-        id = slayer.add_task(session=self.session).id
-        slayer.edit_task(id, current_estimate=expected_current_estimate,
-                session=self.session)
-        task = slayer.get_task(id, session=self.session)
-        self.assertEqual(expected_current_estimate, task.current_estimate)
-
-    def test_whenEditTaskIsCalledWithVersionItShouldBeUpdated(self):
-        self.skipTest('fixme')
-        expected_version = '1.4'
-        id = slayer.add_task(session=self.session).id
-        slayer.edit_task(id, version=expected_version, session=self.session)
-        task = slayer.get_task(id, session=self.session)
-        self.assertEqual(expected_version, task.version)
-
-    def test_whenEditTaskIsCalledWithBacklogOrderItShouldBeUpdated(self):
-        self.skipTest('fixme')
-        expected_backlog_order = 42
-        id = slayer.add_task(session=self.session).id
-        slayer.edit_task(id, backlog_order=expected_backlog_order,
-                session=self.session)
-        task = slayer.get_task(id, session=self.session)
-        self.assertEqual(expected_backlog_order, task.backlog_order)
-
-    def test_whenEditTaskIsCalledWithAreaItShouldBeUpdated(self):
-        self.skipTest('fixme')
-        expected_area = 'some area'
-        id = slayer.add_task(session=self.session).id
-        slayer.edit_task(id, area=expected_area, session=self.session)
-        task = slayer.get_task(id, session=self.session)
-        self.assertEqual(expected_area, task.area)
-
-    def test_whenEditTaskIsCalledWithParentCaseItShouldBeUpdated(self):
-        self.skipTest('fixme')
-        expected_parent_case = slayer.add_task().id
-        id = slayer.add_task(session=self.session).id
-        slayer.edit_task(id, parent_case=expected_parent_case,
-                session=self.session)
-        task = slayer.get_task(id)
-        self.assertEqual(expected_parent_case, task.parent_case)
-
-    def test_whenEditTaskIsCalledWithParentCaseItShouldExist(self):
-        self.skipTest('fixme')
-        bad_parent_case = 70
-        id = slayer.add_task().id
-        with self.assertRaises(ValueError):
-            slayer.edit_task(id, parent_case=bad_parent_case)
-
-    ##############
-    # User Tests #
-    ##############
-    def test_whenUserIsAddedWithoutProvidingIdItShouldDefaultToBlankString(self):
-        self.skipTest('fixme')
-        user = slayer.add_user()
-        self.assertEqual('', user.id)
-
-    def test_whenUserIsAddedGetUserWithIdShouldReturnUser(self):
-        self.skipTest('fixme')
-        user_id = slayer.add_user().id
-        user = slayer.get_user(user_id)
-        self.assertEqual(user_id, user.id)
-
-    def test_whenUserIsAddedWithIdAndNameItShouldSetBoth(self):
-        self.skipTest('fixme')
-        user = slayer.add_user(user_id="uwwerne", name="Wahoo Tango")
-        got_user = slayer.get_user(user.id)
-        self.assertEqual(user.id, got_user.id)
-        self.assertEqual(user.name, got_user.name)
-
-    def test_whenEditUserIsCalledWithWrongIdItShouldValueError(self):
-        self.skipTest('fixme')
-        with self.assertRaises(ValueError):
-            slayer.edit_user(user_id='4135')
-
-    def test_usersShouldBeEqualWhenIdAndNameAreTheSame(self):
-        self.skipTest('fixme')
-        user_a = slayer.User(id='wango', name='tango')
-        user_b = slayer.User(id='wango', name='tango')
-        self.assertEqual(user_a, user_b)
-
-    def test_whenEditUserIsCalledAndUserExistsItShouldReturnUser(self):
-        self.skipTest('fixme')
-        session = slayer.make_session()
-        expected_user = slayer.add_user(user_id='roscivs',
-                                        name='Ross Werner',
-                                        session=session)
-        actual_user = slayer.edit_user('roscivs', session=session)
-        self.assertEqual(expected_user, actual_user)
-
-    def test_whenEditUserIsCalledWithNoneNewIdAndNoneNameItShouldStaySame(self):
-        self.skipTest('fixme')
-        user_id = slayer.add_user(user_id='waynerd', name="Wango Tango",
-                session=self.session).id
-        slayer.edit_user(user_id, new_id=None, new_name=None,
-                session=self.session)
-        user = slayer.get_user(user_id=user_id, session=self.session)
-        self.assertEqual('waynerd', user.id)
-        self.assertEqual('Wango Tango', user.name)
-
-    def test_whenEditUserIsCalledWithNewIdThenOldIdShouldBeGone(self):
-        self.skipTest('fixme')
-        old_id = slayer.add_user(user_id='bob').id
-        slayer.edit_user(old_id, new_id='fnord')
-        user = slayer.get_user(user_id=old_id)
-        self.assertEqual(None, user)
-
-    def test_whenEditUserIsCalledAndNewIdExistsThenShouldRaiseValueError(self):
-        self.skipTest('fixme')
-        taken_id = 'wango'
-        slayer.add_user(user_id=taken_id)
-        good_id = slayer.add_user(user_id='good').id
-        with self.assertRaises(ValueError):
-            slayer.edit_user(good_id, new_id=taken_id)
-
-    def test_whenEditUserIsCalledAndNewNameProvidedThenNameShouldBeNewOne(self):
-        self.skipTest('fixme')
-        user_id = slayer.add_user(user_id='wango', name='').id
-        new_name = 'Tango'
-        slayer.edit_user(user_id, new_name=new_name)
-        user = slayer.get_user(user_id)
-        self.assertEqual(new_name, user.name)
-
-    def test_whenDeleteUserIsCalledWithInvalidIdThenShouldRaiseValueError(self):
-        self.skipTest('fixme')
-        with self.assertRaises(ValueError):
-            slayer.delete_user(user_id='fnord')
-
-    def test_whenDeleteUserIsCalledItShouldReallyDeleteUser(self):
-        self.skipTest('fixme')
-        user_id = 'roscivs'
-        slayer.add_user(user_id=user_id)
-        slayer.delete_user(user_id)
-        actual_user = slayer.get_user(user_id)
-        self.assertEqual(None, actual_user)
-
-
-    #################
-    # Project Tests #
-    #################
-    def test_whenGetProjectIsCalledItShouldReturnTheRightOne(self):
-        self.skipTest('fixme')
-        session = slayer.make_session()
-        expected_project = slayer.Project(name='SRP-014')
-        session.add(expected_project)
-        session.commit()
-        project = slayer.get_project(expected_project.name, session=session)
-        self.assertEqual(expected_project, project)
-
-    def test_whenAddProjectIsCalledWithNoArgumentsTheNameShouldBeEmptyString(self):
-        self.skipTest('fixme')
-        project = slayer.add_project()
-        self.assertEqual('', project.name)
-
-    def test_whenDuplicateProjectNamesAreAddedValueErrorShouldBeRaised(self):
-        self.skipTest('fixme')
-        slayer.add_project('whatever')
-        with self.assertRaises(ValueError):
-            slayer.add_project('whatever')
-
-
-    def test_whenArchiveProjectIsCalledItShouldSetFlagOnProject(self):
-        self.skipTest('fixme')
-        project_name = 'Boog Slayer'
-        slayer.add_project(project_name=project_name)
-        slayer.archive_project(project_name)
-        project = slayer.get_project(project_name)
-
-        self.assertTrue(project.archived)
-
-    def test_whenEditProjectIsCalledWithNewNameThatExistsShouldRaiseValueError(self):
-        self.skipTest('fixme')
-        taken_name = 'Boog Slayer'
-        project_name = 'Boog Player'
-        slayer.add_project(taken_name)
-        slayer.add_project(project_name)
-        with self.assertRaises(ValueError):
-            slayer.edit_project(project_name, new_name=taken_name)
-
-    def test_whenEditProjectIsCalledAndNoProjectHasThatNameShouldRaiseValueError(self):
-        self.skipTest('fixme')
-        with self.assertRaises(ValueError):
-            slayer.edit_project(project_name='whatever, not like you care')
-
-    def test_whenEditProjectIsCalledWithGoodNewNameItShouldSucceed(self):
-        self.skipTest('fixme')
-        new_name = 'F Cancer'
-        project_name = 'Screw Cancer'
-        slayer.add_project(project_name)
-        slayer.edit_project(project_name, new_name=new_name)
-        self.assertTrue(slayer.get_project(new_name) is not None)
-
-    def test_whenEditProjectIsCalledWithNewDescItShouldSucceed(self):
-        self.skipTest('fixme')
-        project_name = 'Symphony in C'
-        desc = 'A Cake song'
-        slayer.add_project(project_name)
-        slayer.edit_project(project_name, new_desc=desc)
-        project = slayer.get_project(project_name)
-
-        self.assertEqual(desc, project.desc)
-
-    def test_whenProjectIsRestoredItShouldSetArchivedToFalse(self):
-        self.skipTest('fixme')
-        project_name = 'Model P Fnord'
-        slayer.add_project(project_name)
-        slayer.archive_project(project_name)
-        slayer.restore_project(project_name)
-        project = slayer.get_project(project_name)
-        self.assertFalse(project.archived)
-
-    def test_whenArchiveProjectIsCalledAndProjectDoesNotExistItShouldValueError(self): 
-        self.skipTest('fixme')
-        with self.assertRaises(ValueError):
-            slayer.archive_project('Doesn\'t matter really')
-
-    def test_whenRestoreProjectIsCalledAndProjectDoesNotExistItShouldValueError(self): 
-        self.skipTest('fixme')
-        with self.assertRaises(ValueError):
-            slayer.restore_project('Doesn\'t matter really')
-
-with test_database(), new_session() as session:
-                      
+with test_database():
     unittest.main()