Exemplo n.º 1
0
 def test_should_not_accept_no_argument_with_bootstrap_or_manage(
         self, mocker):
     """When parsing cmd line should not accept no argument with bootstrap or manage."""
     mocker.patch("sys.argv", ["run.py", "--bootstrap"])
     with pytest.raises(SystemExit, match="2"):
         parse_cmdline()
     mocker.patch("sys.argv", ["run.py", "--manage"])
     with pytest.raises(SystemExit, match="2"):
         parse_cmdline()
Exemplo n.º 2
0
 def test__config_should_still_work(self, mocker):
     """When parsing cmd line --config should still work."""
     abs_config_file = join(getcwd(), "config.ini")
     mocker.patch("sys.argv", ["run.py", "--config", abs_config_file])
     opts = parse_cmdline()
     assert opts["config_file"] == abs_config_file
     assert opts["op"] == "manage"
Exemplo n.º 3
0
 def test_bootstrap_should_accept_an_argument(self, mocker):
     """When parsing cmd line bootstrap should accept an argument."""
     abs_config_file = join(getcwd(), "config.ini")
     mocker.patch("sys.argv", ["run.py", "--bootstrap", abs_config_file])
     opts = parse_cmdline()
     assert opts["config_file"] == abs_config_file
     assert opts["op"] == "bootstrap"
Exemplo n.º 4
0
 def test_should_recognize_the_manage_parameter_when_present(self, mocker):
     """When parsing cmd line should recognize the manage parameter when present."""
     mocker.patch("sys.argv", ["run.py", "--manage", "config.ini"])
     opts = parse_cmdline()
     abs_config_file = join(getcwd(), "config.ini")
     assert opts["config_file"] == abs_config_file
     assert opts["op"] == "manage"
Exemplo n.º 5
0
 def test_should_recognize_a_manage_parameter_with_an_absolute_path(
         self, mocker):
     """When parsing cmd line should recognize a manage parameter with an absolute path."""
     abs_config_file = join(getcwd(), "config.ini")
     mocker.patch("sys.argv", ["run.py", "--manage", abs_config_file])
     opts = parse_cmdline()
     assert opts["config_file"] == abs_config_file
     assert opts["op"] == "manage"
Exemplo n.º 6
0
 def test_either_b_or_m_should_be_provided(self, mocker):
     """When parsing cmd line either -b or -m should be provided."""
     mocker.patch("sys.argv", ["run.py"])
     with pytest.raises(SystemExit, match="2"):
         parse_cmdline()
Exemplo n.º 7
0
 def test_b_and_m_should_be_mutually_exclusive(self, mocker):
     """When parsing cmd line -b and -m should be mutually exclusive."""
     mocker.patch("sys.argv", ["run.py", "-m", "-b"])
     with pytest.raises(SystemExit, match="2"):
         parse_cmdline()