public void AddAzurePythonWebRoleProcess()
        {
            var pyInstall = AddAzureDjangoWebRoleCommand.FindPythonInterpreterPath();
            if (pyInstall == null)
            {
                Assert.Inconclusive("Python is not installed on this machine and therefore the Python tests cannot be run");
                return;
            }

            string stdOut, stdErr;
            ProcessHelper.StartAndWaitForProcess(
                    new ProcessStartInfo(
                        Path.Combine(pyInstall, "python.exe"),
                        String.Format("-m django.bin.django-admin")
                    ),
                    out stdOut,
                    out stdErr
            );

            if (stdOut.IndexOf("django-admin.py") == -1)
            {
                Assert.Inconclusive("Django is not installed on this machine and therefore the Python tests cannot be run");
                return;
            }

            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                string roleName = "WebRole1";
                string serviceName = "AzureService";
                string rootPath = files.CreateNewService(serviceName);
                addPythonWebCmdlet = new AddAzureDjangoWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime };
                addPythonWebCmdlet.CommandRuntime = mockCommandRuntime;
                string expectedVerboseMessage = string.Format(Resources.AddRoleMessageCreatePython, rootPath, roleName);
                mockCommandRuntime.ResetPipelines();

                addPythonWebCmdlet.ExecuteCmdlet();

                AzureAssert.ScaffoldingExists(Path.Combine(rootPath, roleName), Path.Combine(Resources.PythonScaffolding, Resources.WebRole));
                Assert.AreEqual<string>(roleName, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue<string>(Parameters.RoleName));
                Assert.AreEqual<string>(expectedVerboseMessage, mockCommandRuntime.VerboseStream[0]);
                Assert.IsTrue(Directory.Exists(Path.Combine(rootPath, roleName, roleName)));
                Assert.IsTrue(File.Exists(Path.Combine(rootPath, roleName, roleName, "manage.py")));
                Assert.IsTrue(Directory.Exists(Path.Combine(rootPath, roleName, roleName, roleName)));
                Assert.IsTrue(File.Exists(Path.Combine(rootPath, roleName, roleName, roleName, "__init__.py")));
                Assert.IsTrue(File.Exists(Path.Combine(rootPath, roleName, roleName, roleName, "settings.py")));
                Assert.IsTrue(File.Exists(Path.Combine(rootPath, roleName, roleName, roleName, "urls.py")));
                Assert.IsTrue(File.Exists(Path.Combine(rootPath, roleName, roleName, roleName, "wsgi.py")));
            }
        }
        public void AddAzurePythonWebRoleWillRecreateDeploymentSettings()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                string roleName = "WebRole1";
                string serviceName = "AzureService";
                string rootPath = files.CreateNewService(serviceName);
                addPythonWebCmdlet = new AddAzureDjangoWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime };
                addPythonWebCmdlet.CommandRuntime = mockCommandRuntime;
                string expectedVerboseMessage = string.Format(Resources.AddRoleMessageCreatePython, rootPath, roleName);
                string settingsFilePath = Path.Combine(rootPath, Resources.SettingsFileName);
                File.Delete(settingsFilePath);
                Assert.IsFalse(File.Exists(settingsFilePath));

                addPythonWebCmdlet.ExecuteCmdlet();

                AzureAssert.ScaffoldingExists(Path.Combine(rootPath, roleName), Path.Combine(Resources.PythonScaffolding, Resources.WebRole));
                Assert.AreEqual<string>(roleName, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue<string>(Parameters.RoleName));
                Assert.AreEqual<string>(expectedVerboseMessage, mockCommandRuntime.VerboseStream[0]);
                Assert.IsTrue(File.Exists(settingsFilePath));
            }
        }