Beispiel #1
0
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()
Beispiel #2
0
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()
Beispiel #3
0
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()
Beispiel #4
0
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()
Beispiel #5
0
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
Beispiel #6
0
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