@@ -0,0 +1,1730 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Aimport base as test_base%0Afrom passkeeper.git import Git%0Afrom mock import patch, call, mock_open%0A%0Aclass GitTestCase(test_base.TestCase):%0A%0A    def setUp(self):%0A        super(GitTestCase, self).setUp()%0A        self.git = Git('foo')%0A%0A    def tearDown(self):%0A        super(GitTestCase, self).tearDown()%0A%0A    def test_constructor(self):%0A        self.assertEquals(self.git.directory, 'foo')%0A%0A    @patch('passkeeper.git.run_cmd')%0A    def test__run_git_cmd(self, mock_cmd):%0A        self.git._run_git_cmd('bar')%0A%0A        # Will call bar command in foo directory%0A        self.assertEquals(mock_cmd.call_args,%0A                          call('git --work-tree=foo  --git-dir=foo/.git bar'))%0A%0A    @patch('passkeeper.git.Git._run_git_cmd')%0A    def test_init(self, mock_git_cmd):%0A        self.git.init()%0A%0A        calls = %5Bcall('init'), call('config user.name passkeeper')%5D%0A        mock_git_cmd.assert_has_calls(calls)%0A%0A    @patch('passkeeper.git.Git._run_git_cmd')%0A    def test_add(self, mock_git_cmd):%0A        self.git.add(files = %5B'f1', 'f2'%5D)%0A%0A        calls = %5Bcall('add f1'), call('add f2')%5D%0A        mock_git_cmd.assert_has_calls(calls)%0A%0A    @patch('passkeeper.git.Git.add')%0A    @patch('passkeeper.git.Git.commit')%0A    def test_add_gitignore(self, mock_commit, mock_add):%0A        with patch('__builtin__.open', mock_open(), create=True) as file_mock:%0A            handle = file_mock()%0A            self.git.add_gitignore(lines = %5B'foo', 'bar'%5D)%0A%0A            file_mock.assert_called_with('foo/.gitignore', 'w')%0A            handle.write.assert_called_once_with('foo%5Cnbar')%0A        mock_add.assert_called_once_with(%5B'.gitignore'%5D)%0A        mock_commit.assert_called_once_with('Update .gitignore file')%0A

Add unittest for git.py