# Path: jirafs/utils.py
# def convert_to_boolean(string):
# def stash_local_changes(repo):
# def get_user_input(message, options=None, boolean=False, password=False):
# def run_command_method_with_kwargs(command, method=None, **kwargs):
# def get_installed_commands():
# def get_installed_plugins(subclass=Plugin):
# def get_config_path(filename):
# def get_config(additional_configs=None, include_global=True):
# def set_global_config_value(section, key, value):
# def get_default_jira_server(config=None):
# def get_jira(domain=None, config=None):
#     def get_section(config, domain):
# def get_git_version():
# def lazy_get_jira():
# def format_date(folder, date):
# def find_files_referenced_in_markup(markup: str) -> Dict[str, Tuple[str, int, int]]:
# def get_comment_author_display(comment: Comment) -> Optional[str]:
# 
# Path: tests/base.py
# class BaseTestCase(TestCase):
#     def get_asset_path(self, filename):
#         return os.path.join(os.path.dirname(__file__), "assets", filename)
# 
#     def get_asset_contents(self, filename, mode="r"):
#         path = self.get_asset_path(filename)
# 
#         with io.open(path, mode, encoding="utf-8") as r:
#             return r.read()
# 
#     def rehydrate_issue(self, filename):
#         stored = json.loads(self.get_asset_contents(filename))
#         return Issue(
#             stored["options"],
#             None,
#             stored["raw"],
#         )
# 
#     def get_empty_status(self):
#         return {
#             "ready": {
#                 "files": [],
#                 "links": {},
#                 "fields": {},
#                 "new_comment": "",
#                 "deleted": [],
#             },
#             "uncommitted": {
#                 "files": [],
#                 "links": {},
#                 "fields": {},
#                 "new_comment": "",
#                 "deleted": [],
#             },
#             "local_uncommitted": {"files": []},
#             "conflicts": {},
#             "up_to_date": True,
#         }


from distutils.version import LooseVersion
from jirafs import utils
from .base import BaseTestCase
import mock
        repo = mock.Mock()
        repo.version = 10

        with utils.stash_local_changes(repo):
            pass

        self.assertEqual(
            repo.run_git_command.call_count,
            3,
        )

    def test_stash_local_changes_exception(self):
        repo = mock.Mock()
        repo.version = 10

        with self.assertRaises(Exception):
            with utils.stash_local_changes(repo):
                raise Exception()

        self.assertEqual(
            repo.run_git_command.call_count,
            3,
        )


class TestParseGitVersion(BaseTestCase):
    @mock.patch("jirafs.utils.subprocess.check_output")
    def test_parse_osx_git_version(self, git_version_output):
        git_version_output.return_value = b"git version 1.8.5.2 (Apple Git-48)"


# Path: jirafs/utils.py
# def convert_to_boolean(string):
# def stash_local_changes(repo):
# def get_user_input(message, options=None, boolean=False, password=False):
# def run_command_method_with_kwargs(command, method=None, **kwargs):
# def get_installed_commands():
# def get_installed_plugins(subclass=Plugin):
# def get_config_path(filename):
# def get_config(additional_configs=None, include_global=True):
# def set_global_config_value(section, key, value):
# def get_default_jira_server(config=None):
# def get_jira(domain=None, config=None):
#     def get_section(config, domain):
# def get_git_version():
# def lazy_get_jira():
# def format_date(folder, date):
# def find_files_referenced_in_markup(markup: str) -> Dict[str, Tuple[str, int, int]]:
# def get_comment_author_display(comment: Comment) -> Optional[str]:
# 
# Path: tests/base.py
# class BaseTestCase(TestCase):
#     def get_asset_path(self, filename):
#         return os.path.join(os.path.dirname(__file__), "assets", filename)
# 
#     def get_asset_contents(self, filename, mode="r"):
#         path = self.get_asset_path(filename)
# 
#         with io.open(path, mode, encoding="utf-8") as r:
#             return r.read()
# 
#     def rehydrate_issue(self, filename):
#         stored = json.loads(self.get_asset_contents(filename))
#         return Issue(
#             stored["options"],
#             None,
#             stored["raw"],
#         )
# 
#     def get_empty_status(self):
#         return {
#             "ready": {
#                 "files": [],
#                 "links": {},
#                 "fields": {},
#                 "new_comment": "",
#                 "deleted": [],
#             },
#             "uncommitted": {
#                 "files": [],
#                 "links": {},
#                 "fields": {},
#                 "new_comment": "",
#                 "deleted": [],
#             },
#             "local_uncommitted": {"files": []},
#             "conflicts": {},
#             "up_to_date": True,
#         }


# Path: tests/test_utils.py
from distutils.version import LooseVersion
from jirafs import utils
from .base import BaseTestCase
import mock

        repo = mock.Mock()
        repo.version = 10

        with utils.stash_local_changes(repo):
            pass

        self.assertEqual(
            repo.run_git_command.call_count,
            3,
        )

    def test_stash_local_changes_exception(self):
        repo = mock.Mock()
        repo.version = 10

        with self.assertRaises(Exception):
            with utils.stash_local_changes(repo):
                raise Exception()

        self.assertEqual(
            repo.run_git_command.call_count,
            3,
        )


class TestParseGitVersion(BaseTestCase):
    @mock.patch("jirafs.utils.subprocess.check_output")
    def test_parse_osx_git_version(self, git_version_output):
        git_version_output.return_value = b"git version 1.8.5.2 (Apple Git-48)"


        actual_version = utils.get_git_version()