Esempio n. 1
0
 def test_shell_options(self):
     vexrc = Vexrc()
     vexrc[vexrc.default_heading]['shell'] = '/bin/dish'
     options = Object(rest=['given', 'command'])
     environ = {'SHELL': 'wrong'}
     assert main.get_command(options, vexrc,
                             environ) == ['given', 'command']
Esempio n. 2
0
 def test_unknown_shell(self):
     vexrc = Vexrc()
     output = shell_config_for('unlikely_name', vexrc, {})
     assert output.strip() == b''
Esempio n. 3
0
 def test_fish_config_scary(self):
     vexrc = Vexrc()
     output = shell_config_for("fish", vexrc, {'WORKON_HOME': '$x'})
     assert output
     assert b'$x' not in output
Esempio n. 4
0
 def test_fish_config_not_scary(self):
     vexrc = Vexrc()
     with patch('os.path.exists', returnvalue=True):
         output = shell_config_for("fish", vexrc, {'WORKON_HOME': '/hoorj'})
     assert output
     assert b'/hoorj' in output
Esempio n. 5
0
 def test_fish_config(self):
     vexrc = Vexrc()
     output = shell_config_for("fish", vexrc, {})
     assert output
Esempio n. 6
0
 def test_nothing(self):
     vexrc = Vexrc()
     options = argparse.Namespace(rest=None)
     environ = {}
     with raises(exceptions.InvalidCommand):
         main.get_command(options, vexrc, environ)
Esempio n. 7
0
 def test_flag(self):
     vexrc = Vexrc()
     options = argparse.Namespace(rest=['--foo'])
     environ = {}
     with raises(exceptions.InvalidCommand):
         main.get_command(options, vexrc, environ)
Esempio n. 8
0
 def test_shell_environ(self):
     vexrc = Vexrc()
     options = Object(rest=None)
     environ = {'SHELL': '/bin/dish'}
     assert main.get_command(options, vexrc, environ) == ['/bin/dish']
Esempio n. 9
0
 def test_shell_vexrc(self):
     vexrc = Vexrc()
     vexrc[vexrc.default_heading]["shell"] = "/bin/dish"
     options = Object(rest=None)
     environ = {"SHELL": "wrong"}
     assert main.get_command(options, vexrc, environ) == ["/bin/dish"]
Esempio n. 10
0
 def test_shell_environ(self):
     vexrc = Vexrc()
     options = Object(rest=None)
     environ = {"SHELL": "/bin/dish"}
     assert main.get_command(options, vexrc, environ) == ["/bin/dish"]
Esempio n. 11
0
 def test_fish_config_scary(self):
     vexrc = Vexrc()
     output = shell_config_for("fish", vexrc, {"WORKON_HOME": "$x"})
     assert output
     assert b"$x" not in output
Esempio n. 12
0
 def test_fish_config_not_scary(self):
     vexrc = Vexrc()
     with patch("os.path.exists", returnvalue=True):
         output = shell_config_for("fish", vexrc, {"WORKON_HOME": "/hoorj"})
     assert output
     assert b"/hoorj" in output