Example #1
0
def test_GetEditor_git_editor_envvar(monkeypatch):
    monkeypatch.setenv('EDITOR', 'custom git editor')
    assert utils.get_editor() == ['custom', 'git', 'editor']
Example #2
0
def test_GetEditor_editor_environment_editor(monkeypatch):
    monkeypatch.setenv('EDITOR', 'editor')
    assert utils.get_editor() == ['editor', ]
Example #3
0
 def test_editor_environment_editor(self, getenv, get_git_config_val):
     def fake_env(key, default=None):
         return {'EDITOR': 'editor'}.get(key, default)
     getenv.side_effect = fake_env
     get_git_config_val.return_value = None
     assert_equals(utils.get_editor(), 'editor')
Example #4
0
 def test_editor_default(self, getenv, get_git_config_val):
     def fake_env(key, default=None):
         return default
     getenv.side_effect = fake_env
     get_git_config_val.return_value = None
     assert_equals(utils.get_editor(), 'vi')
Example #5
0
 def test_editor_environment_visual(self, getenv, get_git_config_val):
     def fake_env(key, default=None):
         return {'VISUAL': 'visual'}.get(key)
     getenv.side_effect = fake_env
     get_git_config_val.return_value = None
     assert_equals(utils.get_editor(), 'visual')
Example #6
0
 def test_git_editor_config(self, getenv, get_git_config_val):
     getenv.return_value = None
     get_git_config_val.return_value = 'custom config editor'
     assert_equals(utils.get_editor(), 'custom config editor')
Example #7
0
 def test_git_editor_envvar(self, getenv):
     getenv.return_value = 'custom git editor'
     assert_equals(utils.get_editor(), 'custom git editor')
Example #8
0
 def test_editor_environment_editor(self):
     with patch.dict('os.environ', {'EDITOR': 'editor'}, clear=True):
         expect(utils.get_editor()) == ['editor', ]
Example #9
0
 def test_git_editor_envvar(self):
     with patch.dict('os.environ', {'EDITOR': 'custom git editor'},
                     clear=True):
         expect(utils.get_editor()) == ['custom', 'git', 'editor']