def test_check_file_names_with_dupes_return_errors(self): paths = ['some/path', 'some/PAth'] result = util.check_file_names(paths) expected = [ Error( CRITICAL, "Duplicate files: 'some/PAth' and 'some/path' have the same case-insensitive file name") ] assert expected == result
def test_check_file_names_with_no_invalid_char_return_no_error(self): paths = [ 'locations/file', 'locations/file1', 'locations/file2', 'locations/dir1/file2', 'locations/dir1/dir2/file1', 'locations/dir2/file1' ] expected = [] result = util.check_file_names(paths) assert expected == result
def test_check_file_names_with_no_invalid_char_return_no_error(self): paths = [ 'locations/file', 'locations/file1', 'locations/file2', 'locations/dir1/file2', 'locations/dir1/dir2/file1', 'locations/dir2/file1'] expected = [] result = util.check_file_names(paths) assert expected == result
def test_check_file_names_with_invalid_chars_return_errors(self): paths = [ 'locations/file', 'locations/file with space', 'locations/dir1/dir2/file1', 'locations/dir2/file1' ] expected = [Error(CRITICAL, "Invalid characters ' ' in file name at: 'locations/file with space'")] result = util.check_file_names(paths) assert expected[0].message == result[0].message assert expected == result
def test_check_file_names_with_invalid_chars_return_errors(self): paths = [ 'locations/file', 'locations/file with space', 'locations/dir1/dir2/file1', 'locations/dir2/file1' ] expected = [ Error( CRITICAL, "Invalid characters ' ' in file name at: 'locations/file with space'" ) ] result = util.check_file_names(paths) assert expected[0].message == result[0].message assert expected == result
def test_check_file_names_with_invalid_chars_return_errors(self): paths = [ 'locations/file', 'locations/file with space', 'locations/dir1/dir2/file1', 'locations/dir2/file1', 'Accessibilité/ périmètre' ] import sys if sys.version_info[0] < 3: # python2 expected = [Error(CRITICAL, b"Invalid characters '\xe9\xe8' in file name at: 'Accessibilit\xe9/ p\xe9rim\xe8tre'")] else: expected = [Error(CRITICAL, "Invalid characters 'éè' in file name at: 'Accessibilité/ périmètre'")] result = util.check_file_names(paths) assert expected[0].message == result[0].message assert expected == result
def test_check_file_names_without_dupes_return_no_error(self): paths = ['some/path', 'some/otherpath'] result = util.check_file_names(paths) expected = [] assert expected == result
def test_check_file_names_with_dupes_return_errors(self): paths = ['some/path', 'some/PAth'] result = util.check_file_names(paths) expected = [Error(CRITICAL, "Duplicate files: 'some/PAth' and 'some/path' have the same case-insensitive file name")] assert expected == result