def test_README(): generator.initialize_dir() generator.generate_readme() test = open(install_config.install_location + '/INSTALL_README.txt', 'r') test.readline() check = open('tests/TestFiles/outputs/ExpectedREADME', 'r') check.readline() val = Helper.compare_files(test, check) test.close() check.close() assert val os.remove(install_config.install_location + '/INSTALL_README.txt')
def test_macro_replace_file(): testFile = 'tests/TestFiles/outputs/MacroExpectedFile' inputFile = 'tests/TestFiles/inputs/MacroTestFile' shutil.copy(inputFile, inputFile + '_TEST') macros = install_config.build_flags config_injector.update_macros_file(macros, 'tests/TestFiles/inputs', 'MacroTestFile_TEST', comment_unsupported=True) temp = open(inputFile + '_TEST', 'r') expected = open(testFile, 'r') assert Helper.compare_files(temp, expected) temp.close() expected.close() os.remove(inputFile + '_TEST') shutil.rmtree('tests/TestFiles/inputs/OLD_FILES')
def test_inject_into_file(): testFile = 'tests/TestFiles/outputs/InjectExpectedFile' inputFile = 'tests/TestFiles/inputs/InjectTestFile' shutil.copy(inputFile, inputFile + '_TEST') for injector in install_config.injector_files: if injector.name == 'AUTOSAVE_CONFIG': config_injector.inject_to_file(injector) temp = open(inputFile + '_TEST', 'r') expected = open(testFile, 'r') assert Helper.compare_files(temp, expected) temp.close() expected.close() os.remove(inputFile + '_TEST')
def test_uninstall_script(): generator.initialize_dir() generator.generate_uninstall() test = open( install_config.install_location + '/autogenerated/uninstall.sh', 'r') test.readline() test.readline() check = open('tests/TestFiles/outputs/ExpectedUninstallScript', 'r') check.readline() check.readline() val = Helper.compare_files(test, check) test.close() check.close() assert val shutil.rmtree(install_config.install_location + '/autogenerated')