Exemplo n.º 1
0
 def test_project_is_set(self):
     with mock.patch('taskmage2.project.projects.id',
                     return_value=139844126520592):
         project_a = projects.Project(_sample_project_dir)
         assert repr(
             project_a) == '<Project({}) at 0x7f2fff7c3510>'.format(
                 os.path.relpath(_sample_project_dir))
Exemplo n.º 2
0
def create_project():
    """ Interactive Vim Prompt to create a new TaskMage project.
    ( in any location )
    """
    vim.command('call inputsave()')
    vim.command(
        "let projectroot=input('Create New Ptask Project at: ', '.', 'file' )")
    vim.command('call inputrestore()')
    projectroot = vim.eval('projectroot')

    if not projectroot:
        print('No project defined. aborting')
        return

    projectroot = projects.Project.create(projectroot)
    project = projects.Project(projectroot)
    return project
Exemplo n.º 3
0
 def test_is_active_path(self):
     project = projects.Project(None)
     project._root = '/src/project'
     is_active_path = project.is_active_path(
         '/src/project/subdir/file.mtask')
     assert is_active_path is True
Exemplo n.º 4
0
 def test_is_not_archived_path(self):
     project = projects.Project(None)
     project._root = '/src/project'
     is_archived_path = project.is_archived_path(
         '/src/project/subdir/file.mtask')
     assert is_archived_path is False
Exemplo n.º 5
0
 def test_load_sets_root(self):
     with mock.patch('{}.Project.find'.format(ns),
                     return_value='/src/project'):
         project = projects.Project(None)
         project.load('/src/project')
     assert project.root == '/src/project'
Exemplo n.º 6
0
 def test_project_is_none(self):
     with mock.patch('taskmage2.project.projects.id',
                     return_value=139844126520592):
         project_a = projects.Project(None)
         assert repr(project_a) == '<Project(None) at 0x7f2fff7c3510>'
Exemplo n.º 7
0
 def test_project_hash_is_different_from_string(self):
     project = projects.Project(_sample_project_dir)
     assert hash(project) != hash(project.root)
Exemplo n.º 8
0
 def test_projects_with_different_file_do_not_share_hash_value(self):
     project_a = projects.Project(None)
     project_b = projects.Project(_sample_project_dir)
     assert hash(project_a) != hash(project_b)
Exemplo n.º 9
0
 def test_projects_with_same_file_share_hash_value(self):
     project_a = projects.Project(None)
     project_b = projects.Project(None)
     assert hash(project_a) == hash(project_b)
Exemplo n.º 10
0
 def test_get_active_path(self):
     project = projects.Project(None)
     project._root = '/src/project'
     archived_path = project.get_active_path(
         '/src/project/.taskmage/subdir/file.mtask')
     assert archived_path == '/src/project/subdir/file.mtask'