Example #1
0
def test_check_command_file(fake_exists, fake_puts, fake_open, monkeypatch):
    monkeypatch.setenv("ROOT_PWD", "some-password")
    check_command_file(cmd_file="commands.file")
    result = tuple(args[0][0] for args in fake_puts.call_args_list)
    expected = (
        "# some command file",
        "",
        "write /tgt/file:data\\\nmore data\\\neven more data",
        "upload /some/data.dat:/var/lib/data.dat",
        "root-password password:some-password",
        "run /some/script.sh",
        "selinux-relabel",
    )
    assert result == expected
    assert fake_exists.call_count == 2
    assert fake_exists.call_args_list == [mock.call("/some/data.dat"), mock.call("/some/script.sh")]
Example #2
0
def test_check_command_file(fake_exists, fake_puts, fake_open, monkeypatch):
    monkeypatch.setenv('ROOT_PWD', 'some-password')
    check_command_file(cmd_file='commands.file')
    result = tuple(args[0][0] for args in fake_puts.call_args_list)
    expected = (
        '# some command file',
        '',
        'write /tgt/file:data\\\nmore data\\\neven more data',
        'upload /some/data.dat:/var/lib/data.dat',
        'root-password password:some-password',
        'run /some/script.sh',
        'selinux-relabel',
    )
    assert result == expected
    assert fake_exists.call_count == 2
    assert fake_exists.call_args_list == [
        mock.call('/some/data.dat'),
        mock.call('/some/script.sh')
    ]
Example #3
0
def test_check_command_file_errors(fake_exists, fake_abort, fake_open):
    check_command_file(cmd_file='commands.file')
    assert fake_abort.call_count == 1
Example #4
0
def test_check_command_file_errors(fake_exists, fake_abort, fake_open):
    check_command_file(cmd_file="commands.file")
    assert fake_abort.call_count == 1