def test_parse_text(self, d): os.chdir(d.path) process_data = ProcessData() process_data.reset() repository = Repository.from_dict({ 'type': 'github', 'name': 'ezored/dependency-sample', 'version': 't:1.0.0', }) process_data.set_dependency_data( name=repository.get_name(), temp_dir=repository.get_temp_dir(), vendor_dir=repository.get_vendor_dir(), source_dir=repository.get_source_dir(), build_dir=repository.get_vendor_dir(), ) parsed_text = process_data.parse_text('${EZORED_DEPENDENCY_TEMP_DIR}') self.assertEqual(parsed_text, repository.get_temp_dir()) parsed_text = process_data.parse_text('${EZORED_DEPENDENCY_BUILD_DIR}') self.assertEqual(parsed_text, repository.get_vendor_dir()) parsed_text = process_data.parse_text( '${EZORED_DEPENDENCY_VENDOR_DIR}') self.assertEqual(parsed_text, repository.get_vendor_dir()) parsed_text = process_data.parse_text('${EZORED_PROJECT_HOME}') self.assertEqual(parsed_text, process_data.project_home_dir)
def test_parse_text_list(self, d): os.chdir(d.path) process_data = ProcessData() process_data.reset() repository = Repository.from_dict({ 'type': 'git', 'path': 'https://github.com/ezored/dependency-sample.git', 'version': 't:1.0.0', }) process_data.set_dependency_data( name=repository.get_name(), temp_dir=repository.get_temp_dir(), vendor_dir=repository.get_vendor_dir(), source_dir=repository.get_source_dir(), build_dir=repository.get_vendor_dir(), ) parse_text_list = [ '${EZORED_DEPENDENCY_TEMP_DIR}', '${EZORED_DEPENDENCY_BUILD_DIR}', '${EZORED_DEPENDENCY_VENDOR_DIR}', '${EZORED_PROJECT_HOME}', ] parsed_text_list = process_data.parse_text_list(parse_text_list) self.assertEqual(parsed_text_list[0], process_data.dependency_temp_dir) self.assertEqual(parsed_text_list[1], process_data.dependency_build_dir) self.assertEqual(parsed_text_list[2], process_data.dependency_vendor_dir) self.assertEqual(parsed_text_list[3], process_data.project_home_dir)
def test_set_repository_name(self, d): os.chdir(d.path) repository_name = 'test-repository' process_data = ProcessData() process_data.reset() repository = Repository.from_dict({ 'type': 'github', 'name': 'ezored/dependency-sample', 'version': 't:1.0.0', }) process_data.set_dependency_data( name=repository_name, temp_dir=repository.get_temp_dir(), vendor_dir=repository.get_vendor_dir(), source_dir=repository.get_source_dir(), build_dir=repository.get_vendor_dir(), ) self.assertEqual(process_data.dependency_name, repository_name)