Пример #1
0
def test_sudo_file_save_load():
    sudo = Sudo()
    source = "abrakadabra"
    file = "/tmp/test_sudo_file_save_load"
    sudo.file_save(file, source)
    target = sudo.file_load(file)
    sudo.files_delete(file)
    assert source == target
Пример #2
0
def test_make_file_digest():
    print()
    sudo = Sudo()
    text = ""
    path = "/tmp/test_make_file_digest"
    sudo.file_save(path, text)
    digest = make_file_digest(path)
    sudo.files_delete(path)
    assert digest == "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
Пример #3
0
def test_sudo_xattr_get_set():
    sudo = Sudo()
    name = 'tester'
    source = "abra '{' kadabra '}' abra"
    file = "/var/test-sudo-xattr-get-set"
    sudo.file_save(file, source)
    sudo.xattr_set(file, name, source)
    target = sudo.xattr_get(file, name)
    sudo.files_delete(file)
    assert source == target
Пример #4
0
def test_sudo_xattr_load_save():
    sudo = Sudo()
    assert sudo.xattr_space() == 'user.nspawn.'
    assert sudo.xattr_regex() == '^user[.]nspawn[.]'
    source = dict(
        num1='1',
        num2='2.0',
        one="one ':' one ':' one",
        two="two '{'} two [']' two",
        any="hello '{'} (###) [']' kitty",
    )
    file = "/var/test-sudo-xattr-load-save"
    sudo.file_save(file, "")
    sudo.xattr_save(file, source)
    target = sudo.xattr_load(file)
    sudo.files_delete(file)
    assert source == target