Example #1
0
    def test_open_git_status__fail(self, pipe_open_cls_mock, sys_mock):
        popen_mock = Mock()
        popen_mock.returncode = 1
        popen_mock.communicate.return_value = (" ", None)
        pipe_open_cls_mock.return_value = popen_mock

        open_git_status()

        self.assertTrue(sys_mock.exit.called)
Example #2
0
    def test_open_git_status(self, pipe_open_cls_mock):
        status = "## branch\n M zsh/test.py\n"
        popen_mock = Mock()
        popen_mock.returncode = 0
        popen_mock.communicate.return_value = (status, None)
        pipe_open_cls_mock.return_value = popen_mock

        results = open_git_status()

        self.assertListEqual(
            [u"## branch", u" M zsh/test.py"],
            results.splitlines(),
        )