def test_unrelated_file(self, tmpdir): dir_name = "gamedirrrr" file_name = "Vacation Photo-1528.jpg" p = tmpdir.mkdir(dir_name).join(file_name) p.write("") dir_path = tmpdir.listdir()[0] g = Gdipak() files = g.get_files_in_dir(dir_path) assert (len(files) == 0)
def test_special_chars(self, tmpdir): dir_name = "gamedir 2! (The Redirening)" file_name = "123 !@#$%^&()~S{}[]-=_+'`.bin" p = tmpdir.mkdir(dir_name).join(file_name) p.write("") dir_path = tmpdir.listdir()[0] g = Gdipak() files = g.get_files_in_dir(dir_path) assert (len(files) == 1) out_file_dir, out_file_name = path.split(files[0]) assert (out_file_name == file_name) assert (out_file_dir == path.realpath(dir_path))
def test_alphanumeric(self, tmpdir): dir_name = "gamedir" file_name = "aBcD1234.gdi" p = tmpdir.mkdir(dir_name).join(file_name) p.write("") dir_path = tmpdir.listdir()[0] g = Gdipak() files = g.get_files_in_dir(dir_path) assert (len(files) == 1) out_file_dir, out_file_name = path.split(files[0]) assert (out_file_name == file_name) assert (out_file_dir == path.realpath(dir_path))
def test_multi_files(self, tmpdir): dir_name = "gamedir" file_names = ("mygame.gdi", "mygame(track1).bin", "mygame(track2).bin", "mygame(track3).raw", "mygame.txt") tmp_dir = tmpdir.mkdir(dir_name) for f in file_names: p = tmp_dir.join(f) p.write("") dir_path = tmpdir.listdir()[0] g = Gdipak() files = g.get_files_in_dir(dir_path) assert (len(files) == (len(file_names) - 1)) for f in files: assert (f != file_names[len(file_names) - 1])