コード例 #1
0
ファイル: test_config.py プロジェクト: zippyy/rtv
def test_copy_default_config_cancel():
    "Pressing ``n`` should cancel the copy"

    with NamedTemporaryFile(suffix='.cfg') as fp:
        with mock.patch('rtv.config.six.moves.input', return_value='n'):
            copy_default_config(fp.name)
            assert not fp.read()
コード例 #2
0
ファイル: test_config.py プロジェクト: 5225225/rtv
def test_copy_default_config_cancel():
    "Pressing ``n`` should cancel the copy"

    with NamedTemporaryFile(suffix='.cfg') as fp:
        with mock.patch('rtv.config.six.moves.input', return_value='n'):
            copy_default_config(fp.name)
            assert not fp.read()
コード例 #3
0
ファイル: test_config.py プロジェクト: zippyy/rtv
def test_copy_config_interrupt():
    "Pressing ``Ctrl-C`` should cancel the copy"

    with NamedTemporaryFile(suffix='.cfg') as fp:
        with mock.patch('rtv.config.six.moves.input') as func:
            func.side_effect = KeyboardInterrupt
            copy_default_config(fp.name)
            assert not fp.read()
コード例 #4
0
ファイル: test_config.py プロジェクト: 5225225/rtv
def test_copy_config_interrupt():
    "Pressing ``Ctrl-C`` should cancel the copy"

    with NamedTemporaryFile(suffix='.cfg') as fp:
        with mock.patch('rtv.config.six.moves.input') as func:
            func.side_effect = KeyboardInterrupt
            copy_default_config(fp.name)
            assert not fp.read()
コード例 #5
0
ファイル: test_config.py プロジェクト: rpesche/rtv
def test_copy_default_config():
    "Make sure the default config file was included in the package"

    with NamedTemporaryFile(suffix='.cfg') as fp:
        with mock.patch('rtv.config.six.moves.input', return_value='y'):
            copy_default_config(fp.name)
            assert fp.read()
            permissions = os.stat(fp.name).st_mode & 0o777
            assert permissions == 0o664
コード例 #6
0
ファイル: test_config.py プロジェクト: methos2016/rtv
def test_copy_default_config():
    "Make sure the default config file was included in the package"

    with NamedTemporaryFile(suffix='.cfg') as fp:
        with mock.patch('rtv.config.six.moves.input', return_value='y'):
            copy_default_config(fp.name)
            assert fp.read()
            permissions = os.stat(fp.name).st_mode & 0o777
            assert permissions == 0o664