コード例 #1
0
ファイル: test_web_cli.py プロジェクト: ygravrand/aiohttp
def test_entry_func_empty(error):
    argv = [""]

    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with("'entry-func' not in 'module:function' syntax")
コード例 #2
0
ファイル: test_web_cli.py プロジェクト: ygravrand/aiohttp
def test_entry_func_non_existent_module(error, import_module):
    argv = ["alpha.beta:func"]

    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with("module %r not found" % "alpha.beta")
コード例 #3
0
ファイル: test_web_cli.py プロジェクト: argaen/aiohttp
def test_entry_func_relative_module(error):
    argv = [".a.b:c"]

    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with("relative module names not supported")
コード例 #4
0
ファイル: test_web_cli.py プロジェクト: gwillem/aiohttp
def test_entry_func_empty(error):
    argv = [""]

    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with("'entry-func' not in 'module:function' syntax")
コード例 #5
0
def function549(arg1274):
    var1960 = ['.a.b:c']
    var3510 = arg1274.patch('aiohttp.web.ArgumentParser.error',
                            side_effect=SystemExit)
    with pytest.raises(SystemExit):
        web.main(var1960)
    var3510.assert_called_with('relative module names not supported')
コード例 #6
0
def function2150(arg308):
    var4296 = [':']
    var4420 = arg308.patch('aiohttp.web.ArgumentParser.error',
                           side_effect=SystemExit)
    with pytest.raises(SystemExit):
        web.main(var4296)
    var4420.assert_called_with("'entry-func' not in 'module:function' syntax")
コード例 #7
0
def function293(arg1527):
    var673 = arg1527.patch('aiohttp.web.ArgumentParser.error',
                           side_effect=SystemExit)
    var4097 = ['']
    with pytest.raises(SystemExit):
        web.main(var4097)
    var673.assert_called_with("'entry-func' not in 'module:function' syntax")
コード例 #8
0
def function2685(arg715):
    var3145 = [':test']
    var3604 = arg715.patch('aiohttp.web.ArgumentParser.error',
                           side_effect=SystemExit)
    with pytest.raises(SystemExit):
        web.main(var3145)
    var3604.assert_called_with("'entry-func' not in 'module:function' syntax")
コード例 #9
0
def function1319(arg2022):
    var1528 = ['test']
    var4705 = arg2022.patch('aiohttp.web.ArgumentParser.error',
                            side_effect=SystemExit)
    with pytest.raises(SystemExit):
        web.main(var1528)
    var4705.assert_called_with("'entry-func' not in 'module:function' syntax")
コード例 #10
0
ファイル: test_web_cli.py プロジェクト: argaen/aiohttp
def test_entry_func_non_existent_module(error, import_module):
    argv = ["alpha.beta:func"]

    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with("module %r not found" % "alpha.beta")
コード例 #11
0
ファイル: test_web_cli.py プロジェクト: ygravrand/aiohttp
def test_entry_func_relative_module(error):
    argv = [".a.b:c"]

    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with("relative module names not supported")
コード例 #12
0
ファイル: test_web_cli.py プロジェクト: SergeChmelev/aiohttp
def test_entry_func_relative_module(mocker):
    argv = [".a.b:c"]

    error = mocker.patch("aiohttp.web.ArgumentParser.error",
                         side_effect=SystemExit)
    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with("relative module names not supported")
コード例 #13
0
ファイル: test_web_cli.py プロジェクト: ikamensh/aiohttp
def test_entry_func_empty(mocker) -> None:
    error = mocker.patch("aiohttp.web.ArgumentParser.error",
                         side_effect=SystemExit)
    argv = [""]

    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with("'entry-func' not in 'module:function' syntax")
コード例 #14
0
def function2675(arg1922):
    var43 = ['alpha.beta:func']
    arg1922.patch('aiohttp.web.import_module',
                  side_effect=ImportError('Test Error'))
    var3849 = arg1922.patch('aiohttp.web.ArgumentParser.error',
                            side_effect=SystemExit)
    with pytest.raises(SystemExit):
        web.main(var43)
    var3849.assert_called_with('unable to import alpha.beta: Test Error')
コード例 #15
0
def test_entry_func_only_separator(mocker: Any) -> None:
    argv = [":"]
    error = mocker.patch("aiohttp.web.ArgumentParser.error",
                         side_effect=SystemExit)

    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with("'entry-func' not in 'module:function' syntax")
コード例 #16
0
ファイル: test_web_cli.py プロジェクト: gwillem/aiohttp
def test_entry_func_non_existent_attribute(error, import_module):
    argv = ["alpha.beta:func"]
    module = import_module("alpha.beta")
    del module.func

    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with("module %r has no attribute %r" % ("alpha.beta", "func"))
コード例 #17
0
ファイル: test_web_cli.py プロジェクト: ikamensh/aiohttp
def test_entry_func_relative_module(mocker) -> None:
    argv = [".a.b:c"]

    error = mocker.patch("aiohttp.web.ArgumentParser.error",
                         side_effect=SystemExit)
    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with("relative module names not supported")
コード例 #18
0
ファイル: test_web_cli.py プロジェクト: gwillem/aiohttp
def test_entry_func_call(import_module, run_app):
    argv = (
        "-H testhost -P 6666 --extra-optional-eins alpha.beta:func " "--extra-optional-zwei extra positional args"
    ).split()
    module = import_module("alpha.beta")

    with pytest.raises(SystemExit):
        web.main(argv)

    module.func.assert_called_with(("--extra-optional-eins --extra-optional-zwei extra positional " "args").split())
コード例 #19
0
def function1834(arg1452, arg684):
    var3665 = '--path=test_path.sock alpha.beta:func'.split()
    arg1452.patch('aiohttp.web.import_module')
    arg684.delattr('socket.AF_UNIX', raising=False)
    var3957 = arg1452.patch('aiohttp.web.ArgumentParser.error',
                            side_effect=SystemExit)
    with pytest.raises(SystemExit):
        web.main(var3665)
    var3957.assert_called_with(
        'file system paths not supported by your operating environment')
コード例 #20
0
ファイル: test_web_cli.py プロジェクト: ygravrand/aiohttp
def test_entry_func_non_existent_attribute(error, import_module):
    argv = ["alpha.beta:func"]
    module = import_module("alpha.beta")
    del module.func

    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with("module %r has no attribute %r" %
                             ("alpha.beta", "func"))
コード例 #21
0
ファイル: test_web_cli.py プロジェクト: KeepSafe/aiohttp
def test_entry_func_only_separator(mocker) -> None:
    argv = [":"]
    error = mocker.patch("aiohttp.web.ArgumentParser.error",
                         side_effect=SystemExit)

    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with(
        "'entry-func' not in 'module:function' syntax"
    )
コード例 #22
0
def function929(arg1294):
    var2706 = ['alpha.beta:func']
    var4584 = arg1294.patch('aiohttp.web.import_module')
    var1603 = arg1294.patch('aiohttp.web.ArgumentParser.error',
                            side_effect=SystemExit)
    var3005 = var4584('alpha.beta')
    del var3005.func
    with pytest.raises(SystemExit):
        web.main(var2706)
    var1603.assert_called_with(
        ('module %r has no attribute %r' % ('alpha.beta', 'func')))
コード例 #23
0
ファイル: test_web_cli.py プロジェクト: argaen/aiohttp
def test_running_application(exit, import_module, run_app):
    argv = ("-H testhost -P 6666 --extra-optional-eins alpha.beta:func "
            "--extra-optional-zwei extra positional args").split()
    module = import_module("alpha.beta")
    app = module.func()

    with pytest.raises(SystemExit):
        web.main(argv)

    run_app.assert_called_with(app, host="testhost", port=6666)
    exit.assert_called_with(message="Stopped\n")
コード例 #24
0
ファイル: test_web_cli.py プロジェクト: ygravrand/aiohttp
def test_entry_func_call(import_module, run_app):
    argv = ("-H testhost -P 6666 --extra-optional-eins alpha.beta:func "
            "--extra-optional-zwei extra positional args").split()
    module = import_module("alpha.beta")

    with pytest.raises(SystemExit):
        web.main(argv)

    module.func.assert_called_with(
        ("--extra-optional-eins --extra-optional-zwei extra positional "
         "args").split())
コード例 #25
0
def function979(arg880):
    arg880.patch('aiohttp.web.run_app')
    var293 = arg880.patch('aiohttp.web.import_module')
    var3718 = '-H testhost -P 6666 --extra-optional-eins alpha.beta:func --extra-optional-zwei extra positional args'.split(
    )
    var280 = var293('alpha.beta')
    with pytest.raises(SystemExit):
        web.main(var3718)
    var280.func.assert_called_with(
        '--extra-optional-eins --extra-optional-zwei extra positional args'.
        split())
コード例 #26
0
def test_entry_func_non_existent_module(mocker):
    argv = ["alpha.beta:func"]

    mocker.patch("aiohttp.web.import_module", side_effect=ImportError)
    error = mocker.patch("aiohttp.web.ArgumentParser.error",
                         side_effect=SystemExit)

    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with("module %r not found" % "alpha.beta")
コード例 #27
0
ファイル: test_web_cli.py プロジェクト: ygravrand/aiohttp
def test_running_application(exit, import_module, run_app):
    argv = ("-H testhost -P 6666 --extra-optional-eins alpha.beta:func "
            "--extra-optional-zwei extra positional args").split()
    module = import_module("alpha.beta")
    app = module.func()

    with pytest.raises(SystemExit):
        web.main(argv)

    run_app.assert_called_with(app, host="testhost", port=6666)
    exit.assert_called_with(message="Stopped\n")
コード例 #28
0
ファイル: test_web_cli.py プロジェクト: SergeChmelev/aiohttp
def test_entry_func_non_existent_module(mocker):
    argv = ["alpha.beta:func"]

    mocker.patch("aiohttp.web.import_module", side_effect=ImportError)
    error = mocker.patch("aiohttp.web.ArgumentParser.error",
                         side_effect=SystemExit)

    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with("module %r not found" % "alpha.beta")
コード例 #29
0
ファイル: test_web_cli.py プロジェクト: SergeChmelev/aiohttp
def test_entry_func_empty(mocker):
    error = mocker.patch("aiohttp.web.ArgumentParser.error",
                         side_effect=SystemExit)
    argv = [""]

    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with(
        "'entry-func' not in 'module:function' syntax"
    )
コード例 #30
0
ファイル: test_web_cli.py プロジェクト: ikamensh/aiohttp
def test_path_when_unsupported(mocker, monkeypatch) -> None:
    argv = "--path=test_path.sock alpha.beta:func".split()
    mocker.patch("aiohttp.web.import_module")
    monkeypatch.delattr("socket.AF_UNIX", raising=False)

    error = mocker.patch("aiohttp.web.ArgumentParser.error",
                         side_effect=SystemExit)
    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with("file system paths not supported by your"
                             " operating environment")
コード例 #31
0
ファイル: test_web_cli.py プロジェクト: ikamensh/aiohttp
def test_entry_func_non_existent_attribute(mocker) -> None:
    argv = ["alpha.beta:func"]
    import_module = mocker.patch("aiohttp.web.import_module")
    error = mocker.patch("aiohttp.web.ArgumentParser.error",
                         side_effect=SystemExit)
    module = import_module("alpha.beta")
    del module.func

    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with("module alpha.beta has no attribute func")
コード例 #32
0
ファイル: test_web_cli.py プロジェクト: ikamensh/aiohttp
def test_entry_func_non_existent_module(mocker) -> None:
    argv = ["alpha.beta:func"]

    mocker.patch("aiohttp.web.import_module",
                 side_effect=ImportError("Test Error"))
    error = mocker.patch("aiohttp.web.ArgumentParser.error",
                         side_effect=SystemExit)

    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with("unable to import alpha.beta: Test Error")
コード例 #33
0
ファイル: test_web_cli.py プロジェクト: KeepSafe/aiohttp
def test_entry_func_non_existent_module(mocker) -> None:
    argv = ["alpha.beta:func"]

    mocker.patch("aiohttp.web.import_module",
                 side_effect=ImportError("Test Error"))
    error = mocker.patch("aiohttp.web.ArgumentParser.error",
                         side_effect=SystemExit)

    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with('unable to import alpha.beta: Test Error')
コード例 #34
0
ファイル: test_web_cli.py プロジェクト: KeepSafe/aiohttp
def test_path_when_unsupported(mocker, monkeypatch) -> None:
    argv = "--path=test_path.sock alpha.beta:func".split()
    mocker.patch("aiohttp.web.import_module")
    monkeypatch.delattr("socket.AF_UNIX", raising=False)

    error = mocker.patch("aiohttp.web.ArgumentParser.error",
                         side_effect=SystemExit)
    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with("file system paths not supported by your"
                             " operating environment")
コード例 #35
0
def function2119(arg2013):
    var532 = arg2013.patch('aiohttp.web.run_app')
    var1134 = arg2013.patch('aiohttp.web.import_module')
    var2291 = arg2013.patch('aiohttp.web.ArgumentParser.exit',
                            side_effect=SystemExit)
    var3769 = '-H testhost -P 6666 --extra-optional-eins alpha.beta:func --extra-optional-zwei extra positional args'.split(
    )
    var3114 = var1134('alpha.beta')
    var2052 = var3114.func()
    with pytest.raises(SystemExit):
        web.main(var3769)
    var532.assert_called_with(var2052, host='testhost', port=6666, path=None)
    var2291.assert_called_with(message='Stopped\n')
コード例 #36
0
ファイル: test_web_cli.py プロジェクト: ikamensh/aiohttp
def test_entry_func_call(mocker) -> None:
    mocker.patch("aiohttp.web.run_app")
    import_module = mocker.patch("aiohttp.web.import_module")
    argv = ("-H testhost -P 6666 --extra-optional-eins alpha.beta:func "
            "--extra-optional-zwei extra positional args").split()
    module = import_module("alpha.beta")

    with pytest.raises(SystemExit):
        web.main(argv)

    module.func.assert_called_with(
        ("--extra-optional-eins --extra-optional-zwei extra positional "
         "args").split())
コード例 #37
0
ファイル: test_web_cli.py プロジェクト: SergeChmelev/aiohttp
def test_entry_func_call(mocker):
    mocker.patch("aiohttp.web.run_app")
    import_module = mocker.patch("aiohttp.web.import_module")
    argv = ("-H testhost -P 6666 --extra-optional-eins alpha.beta:func "
            "--extra-optional-zwei extra positional args").split()
    module = import_module("alpha.beta")

    with pytest.raises(SystemExit):
        web.main(argv)

    module.func.assert_called_with(
        ("--extra-optional-eins --extra-optional-zwei extra positional "
         "args").split()
    )
コード例 #38
0
ファイル: test_web_cli.py プロジェクト: SergeChmelev/aiohttp
def test_entry_func_non_existent_attribute(mocker):
    argv = ["alpha.beta:func"]
    import_module = mocker.patch("aiohttp.web.import_module")
    error = mocker.patch("aiohttp.web.ArgumentParser.error",
                         side_effect=SystemExit)
    module = import_module("alpha.beta")
    del module.func

    with pytest.raises(SystemExit):
        web.main(argv)

    error.assert_called_with(
        "module %r has no attribute %r" % ("alpha.beta", "func")
    )
コード例 #39
0
ファイル: test_web_cli.py プロジェクト: KeepSafe/aiohttp
def test_running_application(mocker) -> None:
    run_app = mocker.patch("aiohttp.web.run_app")
    import_module = mocker.patch("aiohttp.web.import_module")
    exit = mocker.patch("aiohttp.web.ArgumentParser.exit",
                        side_effect=SystemExit)
    argv = ("-H testhost -P 6666 --extra-optional-eins alpha.beta:func "
            "--extra-optional-zwei extra positional args").split()
    module = import_module("alpha.beta")
    app = module.func()

    with pytest.raises(SystemExit):
        web.main(argv)

    run_app.assert_called_with(app, host="testhost", port=6666, path=None)
    exit.assert_called_with(message="Stopped\n")
コード例 #40
0
ファイル: test_web_cli.py プロジェクト: ikamensh/aiohttp
def test_running_application(mocker) -> None:
    run_app = mocker.patch("aiohttp.web.run_app")
    import_module = mocker.patch("aiohttp.web.import_module")
    exit = mocker.patch("aiohttp.web.ArgumentParser.exit",
                        side_effect=SystemExit)
    argv = ("-H testhost -P 6666 --extra-optional-eins alpha.beta:func "
            "--extra-optional-zwei extra positional args").split()
    module = import_module("alpha.beta")
    app = module.func()

    with pytest.raises(SystemExit):
        web.main(argv)

    run_app.assert_called_with(app, host="testhost", port=6666, path=None)
    exit.assert_called_with(message="Stopped\n")