Пример #1
0
def test_permission_denied(client):
    execute_command(
        client,
        'sudo chown root {}'.format('/'.join([default_folder,
                                              folder_name])), True)
    with pytest.raises(PermissionDenied):
        get_screenshot(file_name, folder_name)
Пример #2
0
def test_replaced(client):
    assert get_screenshot(file_name, folder_name)
    path = "/".join([default_folder, folder_name, file_name])
    modified_time_command = 'date -r {} +%s'.format(path)
    modified_time_old = int(
        execute_command(client, modified_time_command).read().strip())
    # sleep for time changed event
    time.sleep(1)
    assert get_screenshot(file_name, folder_name)
    modified_time_new = int(
        execute_command(client, modified_time_command).read().strip())
    assert modified_time_new > modified_time_old
Пример #3
0
def test_nested_folder(client):
    nested_folder = folder_name + '/nested'
    execute_command(client, 'cd {}; mkdir {}'.format(default_folder,
                                                     nested_folder), True)
    assert get_screenshot(file_name, nested_folder)
    path = "/".join([default_folder, nested_folder])
    check_content(client, path, file_name)
    check_size(client, path, file_name)
Пример #4
0
def test_spaces(client):
    file_name_with_spaces = 'my ' + file_name
    folder_with_spaces = folder_name + '/my screen shots'
    execute_command(
        client, 'cd {}; mkdir "{}"'.format(default_folder, folder_with_spaces),
        True)
    assert get_screenshot(file_name_with_spaces, folder_with_spaces)
    path = "/".join([default_folder, folder_with_spaces])
    check_content(client, path, file_name_with_spaces)
    check_size(client, path, file_name_with_spaces)
Пример #5
0
def test_folder_does_not_exist(client):
    absent_folder = folder_name + '/absent'
    assert get_screenshot(file_name, absent_folder)
    path = "/".join([default_folder, absent_folder])
    check_content(client, path, file_name)
Пример #6
0
def test_default(client):
    assert get_screenshot(file_name, folder_name)
    path = "/".join([default_folder, folder_name])
    check_content(client, path, file_name)
    check_size(client, path, file_name)
Пример #7
0
def test_unexpected_location(client, test_data):
    folder_negative, error = test_data
    with pytest.raises(error):
        get_screenshot(file_name, folder_negative)
Пример #8
0
def test_unexpected_file_name(client, test_data):
    name_negative, error = test_data
    with pytest.raises(error):
        get_screenshot(name_negative, folder_name)