Beispiel #1
0
 def test_no_options(self) -> None:
     args = parse_args(_DEFAULT_ARGS)
     assert args.schema == "schema"
     assert args.db_url == "url"
     assert args.script_path == "dir"
     assert args.api_level is None
     assert args.max_version is None
     assert not args.ignore_api_level
     assert not args.quiet
     assert not args.json
Beispiel #2
0
 def test_small_m_option__invalid_version(self) -> None:
     with pytest.raises(SystemExit):
         with redirect_stderr(StringIO()):
             parse_args(["script", "-m", "INVALID", "schema", "url", "dir"])
Beispiel #3
0
 def test_small_m_option(self) -> None:
     args = parse_args(["script", "-m", "10", "schema", "url", "dir"])
     assert args.max_version == 10
Beispiel #4
0
 def test_big_and_small_l_option(self) -> None:
     with pytest.raises(SystemExit):
         with redirect_stderr(StringIO()):
             parse_args(
                 ["script", "-L", "-l", "25", "schema", "url", "dir"]
             )
Beispiel #5
0
 def test_big_l_option(self) -> None:
     args = parse_args(["script", "-L", "schema", "url", "dir"])
     assert args.api_level is None
     assert args.ignore_api_level
Beispiel #6
0
 def test_small_l_option__no_argument(self) -> None:
     with pytest.raises(SystemExit):
         with redirect_stderr(StringIO()):
             parse_args(["script", "schema", "url", "dir", "-l"])
Beispiel #7
0
 def test_small_l_option(self) -> None:
     args = parse_args(["script", "-l", "44", "schema", "url", "dir"])
     assert not args.ignore_api_level
     assert args.api_level == 44
Beispiel #8
0
 def test_simple_options(self) -> None:
     args = parse_args(_DEFAULT_ARGS + ["-q", "--json"])
     assert args.quiet
     assert args.json
Beispiel #9
0
 def test_help(self) -> None:
     out = StringIO()
     with pytest.raises(SystemExit):
         with redirect_stdout(out):
             parse_args(["script", "--help"])
     assert out.getvalue().startswith("usage: script")