Ejemplo n.º 1
0
def test_check_file_with_file_n_read_true_write_true_n_create_false(
        create_file):
    check_file(my_file="test_file.txt", read=True, write=True, create=False)
    os.chmod("test_file.txt",
             0o555)  # lecture: 4 écriture: 2 exe: 1 (4 + 2 + 1)
    with pytest.raises(SystemExit):
        check_file(my_file="test_file.txt",
                   read=True,
                   write=True,
                   create=False)
Ejemplo n.º 2
0
def test_check_file_with_file_n_all_true():
    check_file(my_file="test_file.txt", read=True, write=True, create=True)
    if not os.path.exists("test_file.txt"):
        assert 0
    os.unlink("test_file.txt")
Ejemplo n.º 3
0
def test_check_file_with_file_n_all_false(create_file):
    check_file(my_file="test_file.txt", read=False, write=False, create=False)
Ejemplo n.º 4
0
def test_check_file_without_file_read_true_write_true_n_create_false():
    with pytest.raises(SystemExit):
        check_file(my_file="", read=True, write=True, create=False)
Ejemplo n.º 5
0
def test_check_file_without_file_n_all_true():
    with pytest.raises(FileNotFoundError):
        check_file(my_file="", read=True, write=True, create=True)
Ejemplo n.º 6
0
def test_check_file_with_file_n_all_true():
    check_file(my_file="test_file.txt", read=True, write=True, create=True)
    if not os.path.exists("test_file.txt"):
        assert 0
    os.unlink("test_file.txt")
Ejemplo n.º 7
0
def test_check_file_without_file_n_all_false():
    with pytest.raises(SystemExit):
        check_file(my_file="", read=False, write=False, create=False)
Ejemplo n.º 8
0
def test_check_file_with_file_n_read_true_write_true_n_create_false(create_file):
    check_file(my_file="test_file.txt", read=True, write=True, create=False)
    os.chmod("test_file.txt", 0o555)  # lecture: 4 écriture: 2 exe: 1 (4 + 2 + 1)
    with pytest.raises(SystemExit):
        check_file(my_file="test_file.txt", read=True, write=True, create=False)
Ejemplo n.º 9
0
def test_check_file_with_file_n_all_false(create_file):
    check_file(my_file="test_file.txt", read=False, write=False, create=False)
Ejemplo n.º 10
0
def test_check_file_without_file_n_all_true():
    with pytest.raises(FileNotFoundError):
        check_file(my_file="", read=True, write=True, create=True)
Ejemplo n.º 11
0
def test_check_file_without_file_read_true_write_true_n_create_false():
    with pytest.raises(SystemExit):
        check_file(my_file="", read=True, write=True, create=False)
Ejemplo n.º 12
0
def test_check_file_without_file_n_all_false():
    with pytest.raises(SystemExit):
        check_file(my_file="", read=False, write=False, create=False)