Пример #1
0
def test_check_line():
    # TODO: Test other modes
    config.create("~/.hamstall/config")
    config.add_line("Test Line", "~/.hamstall/config")
    assert config.check_line("Test Line", "~/.hamstall/config",
                             "fuzzy") is True
    assert config.check_line("ThisShouldNotBeFound=True", "~/.hamstall/config",
                             "fuzzy") is False
Пример #2
0
def test_erase():
    assert prog_manage.erase() == "Erased"
    assert os.path.isfile(config.full("~/.tarstall/tarstall.py")) is False
    try:
        assert config.check_line("source ~/.tarstall/.bashrc", "~/.bashrc",
                                 "fuzzy") is False
    except FileNotFoundError:
        try:
            config.check_line("source ~/.tarstall/.zshrc", "~/.zshrc",
                              "fuzzy") is False
        except FileNotFoundError:
            raise AssertionError("Please use bash or zsh for testing!")
Пример #3
0
def test_uninstall():
    prog_manage.uninstall("package")
    assert config.check_line(
        "export PATH=$PATH:~/.tarstall/bin/package # package",
        "~/.tarstall/.bashrc", "fuzzy") is False
    assert os.path.isfile(
        config.full("~/.tarstall/bin/package/test.sh")) is False
Пример #4
0
def test_pathify():
    prog_manage.pathify("package")
    assert config.check_line("export PATH=$PATH:~/.hamstall/bin/package # package", "~/.hamstall/.bashrc", "fuzzy")
    prog_manage.pathify("test_program")
    assert config.check_line("export PATH=$PATH:~/.hamstall/bin/test_program # test_program", "~/.hamstall/.bashrc",
                           "fuzzy")
Пример #5
0
def test_erase():
    with pytest.raises(SystemExit):
        prog_manage.erase()
    assert os.path.isfile(config.full("~/.hamstall/hamstall.py")) is False
    assert config.check_line("source ~/.hamstall/.bashrc", "~/.bashrc", "fuzzy") is False
Пример #6
0
def test_add_line():
    config.add_line("Verbose=False\n", "~/.hamstall/config")
    assert config.check_line("Verbose=False", "~/.hamstall/config",
                             "fuzzy") is True
Пример #7
0
def test_remove_line():
    # TODO: Test other modes
    config.remove_line("Test Line", "~/.hamstall/config", "fuzzy")
    assert config.check_line("Verbose=False", "~/.hamstall/config",
                             "fuzzy") is False