def test_create_yaml_dotnet_windows(self): yaml_manager = YamlManager(language=DOTNET, app_type=WINDOWS) yaml_manager.create_yaml() yaml_path = os.path.join(self._current_directory, "pipeline_scripts", "dotnet_windows.yml") result = TestYamlManager.is_two_files_equal("azure-pipelines.yml", yaml_path) self.assertTrue(result)
def test_create_yaml_python_linux(self): yaml_manager = YamlManager(language=PYTHON, app_type=LINUX_CONSUMPTION) yaml_manager.create_yaml() yaml_path = os.path.join(self._current_directory, "pipeline_scripts", "python_linux.yml") result = TestYamlManager.is_two_files_equal("azure-pipelines.yml", yaml_path) self.assertTrue(result)
def test_create_yaml_python_linux_pip(self): # Create a temporary requirements.txt open("requirements.txt", "a").close() yaml_manager = YamlManager(language=PYTHON, app_type=LINUX_CONSUMPTION) yaml_manager.create_yaml() yaml_path = os.path.join(self._current_directory, "pipeline_scripts", "python_linux_pip.yml") result = TestYamlManager.is_two_files_equal("azure-pipelines.yml", yaml_path) self.assertTrue(result)
def test_create_yaml_node_windows_install_build(self): # Create a temporary requirements.txt and make a build script in it with open("package.json", "w") as f: json.dump(obj={"scripts": {"build": "echo test"}}, fp=f) yaml_manager = YamlManager(language=NODE, app_type=WINDOWS) yaml_manager.create_yaml() yaml_path = os.path.join(self._current_directory, "pipeline_scripts", "node_windows_install_build.yml") result = TestYamlManager.is_two_files_equal("azure-pipelines.yml", yaml_path) self.assertTrue(result)
def test_create_yaml_node_linux_install(self): # Create a temporary requirements.txt with open("package.json", "w") as f: json.dump(obj={}, fp=f) yaml_manager = YamlManager(language=NODE, app_type=LINUX_CONSUMPTION) yaml_manager.create_yaml() yaml_path = os.path.join(self._current_directory, "pipeline_scripts", "node_linux_install.yml") result = TestYamlManager.is_two_files_equal("azure-pipelines.yml", yaml_path) self.assertTrue(result)
def test_create_yaml_powershell_windows_extensions(self): # Create a temporary extensions.csproj with open("extensions.csproj", "w") as f: f.write( '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"></Project>' ) yaml_manager = YamlManager(language=POWERSHELL, app_type=WINDOWS) yaml_manager.create_yaml() yaml_path = os.path.join(self._current_directory, "pipeline_scripts", "powershell_windows_extensions.yml") result = TestYamlManager.is_two_files_equal("azure-pipelines.yml", yaml_path) self.assertTrue(result)
def test_create_yaml_python_linux_pip_extensions(self): # Create a temporary requirements.txt # Create a temporary extensions.csproj open("requirements.txt", "a").close() with open("extensions.csproj", "w") as f: f.write( '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"></Project>' ) yaml_manager = YamlManager(language=PYTHON, app_type=LINUX_CONSUMPTION) yaml_manager.create_yaml() yaml_path = os.path.join(self._current_directory, "pipeline_scripts", "python_linux_pip_extensions.yml") result = TestYamlManager.is_two_files_equal("azure-pipelines.yml", yaml_path) self.assertTrue(result)
def test_create_yaml_node_windows_install_build_extensions(self): # Create a temporary requirements.txt and make a build script in it # Create a temporary extensions.csproj with open("package.json", "w") as f: json.dump(obj={"scripts": {"build": "echo test"}}, fp=f) with open("extensions.csproj", "w") as f: f.write( '<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"></Project>' ) yaml_manager = YamlManager(language=NODE, app_type=WINDOWS) yaml_manager.create_yaml() yaml_path = os.path.join(self._current_directory, "pipeline_scripts", "node_windows_install_build_extensions.yml") result = TestYamlManager.is_two_files_equal("azure-pipelines.yml", yaml_path) self.assertTrue(result)
def create_yaml(self, language, appType): # pylint: disable=no-self-use """Create azure pipelines yaml""" yaml_manager = YamlManager(language, appType) yaml_manager.create_yaml()