Exemplo n.º 1
0
 def setUp(self, commit=True):
     TmpPathTestCase.setUp(self)
     self.initialize_repo()
     if commit:
         self.commit_files()
     self.context = context = mock.Mock()
     context.git = git.create()
     context.git.set_worktree(core.getcwd())
     context.cfg = gitcfg.create(context)
     gitcmds.reset()
Exemplo n.º 2
0
 def setUp(self):
     TmpPathTestCase.setUp(self)
     self.initialize_repo()
     self.context = context = mock.Mock()
     context.git = git.create()
     context.git.set_worktree(core.getcwd())
     context.cfg = gitcfg.create(context)
     context.model = self.model = main.create(self.context)
     self.git = context.git
     self.cfg = context.cfg
     self.cfg.reset()
     gitcmds.reset()
Exemplo n.º 3
0
def app_context():
    """Create a repository in a temporary directory and return its ApplicationContext"""
    tmp_directory = tempfile.mkdtemp('-cola-test')
    current_directory = os.getcwd()
    os.chdir(tmp_directory)

    initialize_repo()
    context = Mock()
    context.git = git.create()
    context.git.set_worktree(core.getcwd())
    context.cfg = gitcfg.create(context)
    context.model = main.create(context)

    context.cfg.reset()
    gitcmds.reset()

    yield context

    os.chdir(current_directory)
    shutil.rmtree(tmp_directory, onerror=remove_readonly)
Exemplo n.º 4
0
def mock_context():
    """Return a Mock context for testing"""
    context = Mock()
    context.git = git.create()
    return context
Exemplo n.º 5
0
 def setUp(self):
     self.context = context = mock.Mock()
     context.git = git.create()
     self.remote = 'server'
     self.local_branch = 'local'
     self.remote_branch = 'remote'