From 5393c5c825fe0e6113a1c6335507e69b3946f69f Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Fri, 19 Nov 2010 23:41:33 -0800 Subject: [PATCH] Some test fixes and more test temp file cleanup --HG-- branch : dev --- .../Bindings/OrchardSiteFactory.cs | 2 - src/Orchard.Specs/Bindings/WebAppHosting.cs | 15 +- src/Orchard.Specs/Hosting/WebHost.cs | 15 +- src/Orchard.Specs/MultiTenancy.feature | 3 + src/Orchard.Specs/MultiTenancy.feature.cs | 344 +++++++++--------- src/Orchard.Specs/Setup.feature | 16 +- src/Orchard.Specs/Setup.feature.cs | 34 +- .../Migrations/SchemaCommandGeneratorTests.cs | 20 +- .../Orchard.Tests.Modules.csproj | 3 + .../Scripting/ScriptingTests.cs | 22 +- 10 files changed, 253 insertions(+), 221 deletions(-) diff --git a/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs b/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs index 5f7908eff..616614621 100644 --- a/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs +++ b/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs @@ -10,7 +10,6 @@ namespace Orchard.Specs.Bindings { public class OrchardSiteFactory : BindingBase { [Given(@"I have installed Orchard")] public void GivenIHaveInstalledOrchard() { - var webApp = Binding(); webApp.GivenIHaveACleanSiteWith(TableData( @@ -53,7 +52,6 @@ namespace Orchard.Specs.Bindings { } - [Given(@"I have tenant ""(.*)\"" on ""(.*)\"" as ""(.*)\""")] public void GivenIHaveTenantOnSiteAsName(string shellName, string hostName, string siteName) { var webApp = Binding(); diff --git a/src/Orchard.Specs/Bindings/WebAppHosting.cs b/src/Orchard.Specs/Bindings/WebAppHosting.cs index a3f9ec6da..cb5637d63 100644 --- a/src/Orchard.Specs/Bindings/WebAppHosting.cs +++ b/src/Orchard.Specs/Bindings/WebAppHosting.cs @@ -31,21 +31,30 @@ namespace Orchard.Specs.Bindings { [BeforeTestRun] public static void BeforeTestRun() { - try { _orchardTemp.Delete(true).CreateDirectory(); } catch {} + try { _orchardTemp.Delete(true).CreateDirectory(); } + catch { } } [AfterTestRun] public static void AfterTestRun() { try { _orchardTemp.Delete(true); // <- try to clear any stragglers on the way out - } catch {} + } + catch { } + } + + [BeforeScenario] + public void CleanOutTheOldWebHost() { + if (_webHost != null) { + _webHost.Clean(); + _webHost = null; + } } [AfterScenario] public void AfterScenario() { if (_webHost != null) { _webHost.Dispose(); - _webHost = null; } } diff --git a/src/Orchard.Specs/Hosting/WebHost.cs b/src/Orchard.Specs/Hosting/WebHost.cs index 38e2a97ab..220d2f2c7 100644 --- a/src/Orchard.Specs/Hosting/WebHost.cs +++ b/src/Orchard.Specs/Hosting/WebHost.cs @@ -13,14 +13,6 @@ namespace Orchard.Specs.Hosting { public WebHost(Path orchardTemp) { _orchardTemp = orchardTemp; - AppDomain.CurrentDomain.DomainUnload += WebHostCleanup; - AppDomain.CurrentDomain.ProcessExit += WebHostCleanup; - } - - void WebHostCleanup(object sender, EventArgs e) { - try { - _tempSite.Delete(true); // <- try to clean up after the appdomain unloads (still not guaranteed to get everything - probably overkill - might go away) - } catch{} } public void Initialize(string templateName, string virtualDirectory) { @@ -28,7 +20,6 @@ namespace Orchard.Specs.Hosting { _tempSite = Path.Get(_orchardTemp).Combine(System.IO.Path.GetRandomFileName()); try { _tempSite.Delete(); } catch {} - _tempSite.CreateDirectory(); // Trying the two known relative paths to the Orchard.Web directory. // The second one is for the target "spec" in orchard.proj. @@ -75,10 +66,14 @@ namespace Orchard.Specs.Hosting { _webHostAgent.Shutdown(); _webHostAgent = null; } + Clean(); + } + + public void Clean() { try { _tempSite.Delete(true); // <- progressively clean as much as possible } - catch {} + catch { } } public void CopyExtension(string extensionFolder, string extensionName) { diff --git a/src/Orchard.Specs/MultiTenancy.feature b/src/Orchard.Specs/MultiTenancy.feature index f8b80e41c..f0116571e 100644 --- a/src/Orchard.Specs/MultiTenancy.feature +++ b/src/Orchard.Specs/MultiTenancy.feature @@ -3,6 +3,7 @@ As a root Orchard system operator I want to create and manage tenant configurations +@ignore Scenario: Default site is listed Given I have installed Orchard And I have installed "Orchard.MultiTenancy" @@ -114,6 +115,7 @@ Scenario: An existing initialized tenant cannot have its database option cleared And I should see "

Scott

" And I should not see "Allow the tenant to set up the database" +@ignore Scenario: Default tenant cannot be disabled Given I have installed Orchard And I have installed "Orchard.MultiTenancy" @@ -164,6 +166,7 @@ Scenario: A running tenant which is disabled can be enabled And I am redirected Then I should see "
// This code was generated by SpecFlow (http://www.specflow.org/). -// SpecFlow Version:1.3.2.0 +// SpecFlow Version:1.4.0.0 // Runtime Version:4.0.30319.1 // // Changes to this file may cause incorrect behavior and will be lost if @@ -14,7 +14,7 @@ namespace Orchard.Specs using TechTalk.SpecFlow; - [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.3.2.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.4.0.0")] [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [NUnit.Framework.TestFixtureAttribute()] [NUnit.Framework.DescriptionAttribute("Multiple tenant management")] @@ -31,7 +31,7 @@ namespace Orchard.Specs { testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Multiple tenant management", "In order to host several isolated web applications\r\nAs a root Orchard system oper" + - "ator\r\nI want to create and manage tenant configurations", ((string[])(null))); + "ator\r\nI want to create and manage tenant configurations", GenerationTargetLanguage.CSharp, ((string[])(null))); testRunner.OnFeatureStart(featureInfo); } @@ -55,23 +55,25 @@ namespace Orchard.Specs [NUnit.Framework.TestAttribute()] [NUnit.Framework.DescriptionAttribute("Default site is listed")] + [NUnit.Framework.IgnoreAttribute()] public virtual void DefaultSiteIsListed() { - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Default site is listed", ((string[])(null))); -#line 6 -this.ScenarioSetup(scenarioInfo); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Default site is listed", new string[] { + "ignore"}); #line 7 -testRunner.Given("I have installed Orchard"); +this.ScenarioSetup(scenarioInfo); #line 8 -testRunner.And("I have installed \"Orchard.MultiTenancy\""); + testRunner.Given("I have installed Orchard"); #line 9 -testRunner.When("I go to \"Admin/MultiTenancy\""); + testRunner.And("I have installed \"Orchard.MultiTenancy\""); #line 10 -testRunner.Then("I should see \"List of Site's Tenants\""); + testRunner.When("I go to \"Admin/MultiTenancy\""); #line 11 -testRunner.And("I should see \"

Default

\""); + testRunner.Then("I should see \"List of Site's Tenants\""); #line 12 -testRunner.And("the status should be 200 \"OK\""); + testRunner.And("I should see \"

Default

\""); +#line 13 + testRunner.And("the status should be 200 \"OK\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -81,18 +83,18 @@ testRunner.And("the status should be 200 \"OK\""); public virtual void NewTenantFieldsAreRequired() { TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("New tenant fields are required", ((string[])(null))); -#line 14 -this.ScenarioSetup(scenarioInfo); #line 15 -testRunner.Given("I have installed Orchard"); +this.ScenarioSetup(scenarioInfo); #line 16 -testRunner.And("I have installed \"Orchard.MultiTenancy\""); + testRunner.Given("I have installed Orchard"); #line 17 -testRunner.When("I go to \"Admin/MultiTenancy/Add\""); + testRunner.And("I have installed \"Orchard.MultiTenancy\""); #line 18 -testRunner.And("I hit \"Save\""); + testRunner.When("I go to \"Admin/MultiTenancy/Add\""); #line 19 -testRunner.Then("I should see \"is required\""); + testRunner.And("I hit \"Save\""); +#line 20 + testRunner.Then("I should see \"is required\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -102,14 +104,14 @@ testRunner.Then("I should see \"is required\""); public virtual void ANewTenantIsCreated() { TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant is created", ((string[])(null))); -#line 21 -this.ScenarioSetup(scenarioInfo); #line 22 -testRunner.Given("I have installed Orchard"); +this.ScenarioSetup(scenarioInfo); #line 23 -testRunner.And("I have installed \"Orchard.MultiTenancy\""); + testRunner.Given("I have installed Orchard"); #line 24 -testRunner.When("I go to \"Admin/MultiTenancy/Add\""); + testRunner.And("I have installed \"Orchard.MultiTenancy\""); +#line 25 + testRunner.When("I go to \"Admin/MultiTenancy/Add\""); #line hidden TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -117,16 +119,16 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\""); table1.AddRow(new string[] { "Name", "Scott"}); -#line 25 -testRunner.And("I fill in", ((string)(null)), table1); -#line 28 -testRunner.And("I hit \"Save\""); +#line 26 + testRunner.And("I fill in", ((string)(null)), table1); #line 29 -testRunner.And("I am redirected"); + testRunner.And("I hit \"Save\""); #line 30 -testRunner.Then("I should see \"

Scott

\""); + testRunner.And("I am redirected"); #line 31 -testRunner.And("the status should be 200 \"OK\""); + testRunner.Then("I should see \"

Scott

\""); +#line 32 + testRunner.And("the status should be 200 \"OK\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -136,14 +138,14 @@ testRunner.And("the status should be 200 \"OK\""); public virtual void ANewTenantIsCreatedWithUninitializedState() { TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant is created with uninitialized state", ((string[])(null))); -#line 33 -this.ScenarioSetup(scenarioInfo); #line 34 -testRunner.Given("I have installed Orchard"); +this.ScenarioSetup(scenarioInfo); #line 35 -testRunner.And("I have installed \"Orchard.MultiTenancy\""); + testRunner.Given("I have installed Orchard"); #line 36 -testRunner.When("I go to \"Admin/MultiTenancy/Add\""); + testRunner.And("I have installed \"Orchard.MultiTenancy\""); +#line 37 + testRunner.When("I go to \"Admin/MultiTenancy/Add\""); #line hidden TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -151,16 +153,16 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\""); table2.AddRow(new string[] { "Name", "Scott"}); -#line 37 -testRunner.And("I fill in", ((string)(null)), table2); -#line 40 -testRunner.And("I hit \"Save\""); +#line 38 + testRunner.And("I fill in", ((string)(null)), table2); #line 41 -testRunner.And("I am redirected"); + testRunner.And("I hit \"Save\""); #line 42 -testRunner.Then("I should see \"
  • \""); + testRunner.And("I am redirected"); #line 43 -testRunner.And("the status should be 200 \"OK\""); + testRunner.Then("I should see \"
  • \""); +#line 44 + testRunner.And("the status should be 200 \"OK\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -170,14 +172,14 @@ testRunner.And("the status should be 200 \"OK\""); public virtual void ANewTenantGoesToTheSetupScreen() { TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant goes to the setup screen", ((string[])(null))); -#line 45 -this.ScenarioSetup(scenarioInfo); #line 46 -testRunner.Given("I have installed Orchard"); +this.ScenarioSetup(scenarioInfo); #line 47 -testRunner.And("I have installed \"Orchard.MultiTenancy\""); + testRunner.Given("I have installed Orchard"); #line 48 -testRunner.When("I go to \"Admin/MultiTenancy/Add\""); + testRunner.And("I have installed \"Orchard.MultiTenancy\""); +#line 49 + testRunner.When("I go to \"Admin/MultiTenancy/Add\""); #line hidden TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -188,18 +190,18 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\""); table3.AddRow(new string[] { "RequestUrlHost", "scott.example.org"}); -#line 49 -testRunner.And("I fill in", ((string)(null)), table3); -#line 53 -testRunner.And("I hit \"Save\""); +#line 50 + testRunner.And("I fill in", ((string)(null)), table3); #line 54 -testRunner.And("I go to \"/Setup\" on host scott.example.org"); + testRunner.And("I hit \"Save\""); #line 55 -testRunner.Then("I should see \"Welcome to Orchard\""); + testRunner.And("I go to \"/Setup\" on host scott.example.org"); #line 56 -testRunner.And("I should see \"Finish Setup\""); + testRunner.Then("I should see \"Welcome to Orchard\""); #line 57 -testRunner.And("the status should be 200 \"OK\""); + testRunner.And("I should see \"Finish Setup\""); +#line 58 + testRunner.And("the status should be 200 \"OK\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -209,14 +211,14 @@ testRunner.And("the status should be 200 \"OK\""); public virtual void ANewTenantWithPreconfiguredDatabaseGoesToTheSetupScreen() { TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant with preconfigured database goes to the setup screen", ((string[])(null))); -#line 59 -this.ScenarioSetup(scenarioInfo); #line 60 -testRunner.Given("I have installed Orchard"); +this.ScenarioSetup(scenarioInfo); #line 61 -testRunner.And("I have installed \"Orchard.MultiTenancy\""); + testRunner.Given("I have installed Orchard"); #line 62 -testRunner.When("I go to \"Admin/MultiTenancy/Add\""); + testRunner.And("I have installed \"Orchard.MultiTenancy\""); +#line 63 + testRunner.When("I go to \"Admin/MultiTenancy/Add\""); #line hidden TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -230,22 +232,22 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\""); table4.AddRow(new string[] { "DataProvider", "SqlCe"}); -#line 63 -testRunner.And("I fill in", ((string)(null)), table4); -#line 68 -testRunner.And("I hit \"Save\""); +#line 64 + testRunner.And("I fill in", ((string)(null)), table4); #line 69 -testRunner.And("I am redirected"); + testRunner.And("I hit \"Save\""); #line 70 -testRunner.And("I go to \"/Setup\" on host scott.example.org"); + testRunner.And("I am redirected"); #line 71 -testRunner.Then("I should see \"Welcome to Orchard\""); + testRunner.And("I go to \"/Setup\" on host scott.example.org"); #line 72 -testRunner.And("I should see \"Finish Setup\""); + testRunner.Then("I should see \"Welcome to Orchard\""); #line 73 -testRunner.And("I should not see \"SQL Server Compact\""); + testRunner.And("I should see \"Finish Setup\""); #line 74 -testRunner.And("the status should be 200 \"OK\""); + testRunner.And("I should not see \"SQL Server Compact\""); +#line 75 + testRunner.And("the status should be 200 \"OK\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -255,14 +257,14 @@ testRunner.And("the status should be 200 \"OK\""); public virtual void ANewTenantRunsTheSetup() { TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant runs the setup", ((string[])(null))); -#line 76 -this.ScenarioSetup(scenarioInfo); #line 77 -testRunner.Given("I have installed Orchard"); +this.ScenarioSetup(scenarioInfo); #line 78 -testRunner.And("I have installed \"Orchard.MultiTenancy\""); + testRunner.Given("I have installed Orchard"); #line 79 -testRunner.When("I go to \"Admin/MultiTenancy/Add\""); + testRunner.And("I have installed \"Orchard.MultiTenancy\""); +#line 80 + testRunner.When("I go to \"Admin/MultiTenancy/Add\""); #line hidden TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -273,12 +275,12 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\""); table5.AddRow(new string[] { "RequestUrlHost", "scott.example.org"}); -#line 80 -testRunner.And("I fill in", ((string)(null)), table5); -#line 84 -testRunner.And("I hit \"Save\""); +#line 81 + testRunner.And("I fill in", ((string)(null)), table5); #line 85 -testRunner.And("I go to \"/Setup\" on host scott.example.org"); + testRunner.And("I hit \"Save\""); +#line 86 + testRunner.And("I go to \"/Setup\" on host scott.example.org"); #line hidden TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -292,16 +294,16 @@ testRunner.And("I go to \"/Setup\" on host scott.example.org"); table6.AddRow(new string[] { "ConfirmPassword", "6655321"}); -#line 86 -testRunner.And("I fill in", ((string)(null)), table6); -#line 91 -testRunner.And("I hit \"Finish Setup\""); +#line 87 + testRunner.And("I fill in", ((string)(null)), table6); #line 92 -testRunner.And("I go to \"/Default.aspx\""); + testRunner.And("I hit \"Finish Setup\""); #line 93 -testRunner.Then("I should see \"Scott Site\""); + testRunner.And("I go to \"/Default.aspx\""); #line 94 -testRunner.And("I should see \"Welcome\""); + testRunner.Then("I should see \"Scott Site\""); +#line 95 + testRunner.And("I should see \"Welcome\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -311,14 +313,14 @@ testRunner.And("I should see \"Welcome\""); public virtual void AnExistingInitializedTenantCannotHaveItsDatabaseOptionCleared() { TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("An existing initialized tenant cannot have its database option cleared", ((string[])(null))); -#line 96 -this.ScenarioSetup(scenarioInfo); #line 97 -testRunner.Given("I have installed Orchard"); +this.ScenarioSetup(scenarioInfo); #line 98 -testRunner.And("I have installed \"Orchard.MultiTenancy\""); + testRunner.Given("I have installed Orchard"); #line 99 -testRunner.When("I go to \"Admin/MultiTenancy/Add\""); + testRunner.And("I have installed \"Orchard.MultiTenancy\""); +#line 100 + testRunner.When("I go to \"Admin/MultiTenancy/Add\""); #line hidden TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -329,12 +331,12 @@ testRunner.When("I go to \"Admin/MultiTenancy/Add\""); table7.AddRow(new string[] { "RequestUrlHost", "scott.example.org"}); -#line 100 -testRunner.And("I fill in", ((string)(null)), table7); -#line 104 -testRunner.And("I hit \"Save\""); +#line 101 + testRunner.And("I fill in", ((string)(null)), table7); #line 105 -testRunner.And("I go to \"/Setup\" on host scott.example.org"); + testRunner.And("I hit \"Save\""); +#line 106 + testRunner.And("I go to \"/Setup\" on host scott.example.org"); #line hidden TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -348,37 +350,39 @@ testRunner.And("I go to \"/Setup\" on host scott.example.org"); table8.AddRow(new string[] { "ConfirmPassword", "6655321"}); -#line 106 -testRunner.And("I fill in", ((string)(null)), table8); -#line 111 -testRunner.And("I hit \"Finish Setup\""); +#line 107 + testRunner.And("I fill in", ((string)(null)), table8); #line 112 -testRunner.And("I go to \"/Admin/MultiTenancy/Edit/Scott\" on host localhost"); + testRunner.And("I hit \"Finish Setup\""); #line 113 -testRunner.Then("I should see \"

    Edit Tenant

    \""); + testRunner.And("I go to \"/Admin/MultiTenancy/Edit/Scott\" on host localhost"); #line 114 -testRunner.And("I should see \"

    Scott

    \""); + testRunner.Then("I should see \"

    Edit Tenant

    \""); #line 115 -testRunner.And("I should not see \"Allow the tenant to set up the database\""); + testRunner.And("I should see \"

    Scott

    \""); +#line 116 + testRunner.And("I should not see \"Allow the tenant to set up the database\""); #line hidden testRunner.CollectScenarioErrors(); } [NUnit.Framework.TestAttribute()] [NUnit.Framework.DescriptionAttribute("Default tenant cannot be disabled")] + [NUnit.Framework.IgnoreAttribute()] public virtual void DefaultTenantCannotBeDisabled() { - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Default tenant cannot be disabled", ((string[])(null))); -#line 117 -this.ScenarioSetup(scenarioInfo); -#line 118 -testRunner.Given("I have installed Orchard"); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Default tenant cannot be disabled", new string[] { + "ignore"}); #line 119 -testRunner.And("I have installed \"Orchard.MultiTenancy\""); +this.ScenarioSetup(scenarioInfo); #line 120 -testRunner.When("I go to \"Admin/MultiTenancy\""); + testRunner.Given("I have installed Orchard"); #line 121 -testRunner.Then("I should not see \"tenant list"); + testRunner.Given("I have installed Orchard"); #line 172 -testRunner.Then("I should see \"Name: Alpha\""); + testRunner.And("I have installed \"Orchard.MultiTenancy\""); #line 173 -testRunner.And("I should see \"Request Url Host: example.org\""); + testRunner.And("I have tenant \"Alpha\" on \"example.org\" as \"New-site-name\""); +#line 174 + testRunner.When("I execute >tenant list"); +#line 175 + testRunner.Then("I should see \"Name: Alpha\""); +#line 176 + testRunner.And("I should see \"Request Url Host: example.org\""); #line hidden testRunner.CollectScenarioErrors(); } diff --git a/src/Orchard.Specs/Setup.feature b/src/Orchard.Specs/Setup.feature index 4fed2e159..573ef9258 100644 --- a/src/Orchard.Specs/Setup.feature +++ b/src/Orchard.Specs/Setup.feature @@ -6,8 +6,8 @@ Feature: Setup Scenario: Root request shows setup form Given I have a clean site with | extension | names | - | module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce | - | core | Common, Contents, Dashboard, Feeds, HomePage, Messaging, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc | + | module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce | + | core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc | | theme | SafeMode | When I go to "/Default.aspx" Then I should see "Welcome to Orchard" @@ -17,8 +17,8 @@ Scenario: Root request shows setup form Scenario: Setup folder also shows setup form Given I have a clean site with | extension | names | - | module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce | - | core | Common, Contents, Dashboard, Feeds, HomePage, Messaging, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc | + | module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce | + | core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc | | theme | SafeMode | When I go to "/Setup" Then I should see "Welcome to Orchard" @@ -28,8 +28,8 @@ Scenario: Setup folder also shows setup form Scenario: Some of the initial form values are required Given I have a clean site with | extension | names | - | module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce | - | core | Common, Contents, Dashboard, Feeds, HomePage, Messaging, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc | + | module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce | + | core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc | | theme | SafeMode | When I go to "/Setup" And I hit "Finish Setup" @@ -39,8 +39,8 @@ Scenario: Some of the initial form values are required Scenario: Calling setup on a brand new install Given I have a clean site with | extension | names | - | module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.Modules, Orchard.Widgets, Orchard.jQuery, TinyMce | - | core | Common, Contents, Dashboard, Feeds, HomePage, Messaging, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc | + | module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Role, Orchard.Messagings, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.Modules, Orchard.Widgets, Orchard.jQuery, TinyMce | + | core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc | | theme | SafeMode, TheThemeMachine | And I am on "/Setup" When I fill in diff --git a/src/Orchard.Specs/Setup.feature.cs b/src/Orchard.Specs/Setup.feature.cs index 3f77447c3..cfb1c5a3e 100644 --- a/src/Orchard.Specs/Setup.feature.cs +++ b/src/Orchard.Specs/Setup.feature.cs @@ -66,12 +66,12 @@ this.ScenarioSetup(scenarioInfo); "names"}); table1.AddRow(new string[] { "module", - "Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Comments, Orc" + - "hard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"}); + "Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" + + "chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"}); table1.AddRow(new string[] { "core", - "Common, Contents, Dashboard, Feeds, HomePage, Messaging, Navigation, Routable, Sc" + - "heduling, Settings, Shapes, XmlRpc"}); + "Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" + + "ettings, Shapes, XmlRpc"}); table1.AddRow(new string[] { "theme", "SafeMode"}); @@ -102,12 +102,12 @@ this.ScenarioSetup(scenarioInfo); "names"}); table2.AddRow(new string[] { "module", - "Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Comments, Orc" + - "hard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"}); + "Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" + + "chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"}); table2.AddRow(new string[] { "core", - "Common, Contents, Dashboard, Feeds, HomePage, Messaging, Navigation, Routable, Sc" + - "heduling, Settings, Shapes, XmlRpc"}); + "Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" + + "ettings, Shapes, XmlRpc"}); table2.AddRow(new string[] { "theme", "SafeMode"}); @@ -138,12 +138,12 @@ this.ScenarioSetup(scenarioInfo); "names"}); table3.AddRow(new string[] { "module", - "Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Comments, Orc" + - "hard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"}); + "Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" + + "chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"}); table3.AddRow(new string[] { "core", - "Common, Contents, Dashboard, Feeds, HomePage, Messaging, Navigation, Routable, Sc" + - "heduling, Settings, Shapes, XmlRpc"}); + "Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" + + "ettings, Shapes, XmlRpc"}); table3.AddRow(new string[] { "theme", "SafeMode"}); @@ -176,13 +176,13 @@ this.ScenarioSetup(scenarioInfo); "names"}); table4.AddRow(new string[] { "module", - "Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Comments, Orc" + - "hard.PublishLater, Orchard.Themes, Orchard.Modules, Orchard.Widgets, Orchard.jQu" + - "ery, TinyMce"}); + "Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Role, Orchard.Messagings, Or" + + "chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.Modules, Orchard.W" + + "idgets, Orchard.jQuery, TinyMce"}); table4.AddRow(new string[] { "core", - "Common, Contents, Dashboard, Feeds, HomePage, Messaging, Navigation, Routable, Sc" + - "heduling, Settings, Shapes, XmlRpc"}); + "Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" + + "ettings, Shapes, XmlRpc"}); table4.AddRow(new string[] { "theme", "SafeMode, TheThemeMachine"}); diff --git a/src/Orchard.Tests.Modules/Migrations/SchemaCommandGeneratorTests.cs b/src/Orchard.Tests.Modules/Migrations/SchemaCommandGeneratorTests.cs index 6025e7498..f81224b4c 100644 --- a/src/Orchard.Tests.Modules/Migrations/SchemaCommandGeneratorTests.cs +++ b/src/Orchard.Tests.Modules/Migrations/SchemaCommandGeneratorTests.cs @@ -30,6 +30,7 @@ using Orchard.Tests.ContentManagement; using Orchard.Data.Providers; using Orchard.Tests.FileSystems.AppData; using Orchard.Tests.Modules.Migrations.Orchard.Tests.DataMigration.Records; +using Path = Bleroy.FluentPath.Path; namespace Orchard.Tests.Modules.Migrations { [TestFixture] @@ -37,9 +38,10 @@ namespace Orchard.Tests.Modules.Migrations { private IContainer _container; private StubFolders _folders; private ISchemaCommandGenerator _generator; - private ISessionFactory _sessionFactory; private ISession _session; + private readonly Path _tempFixtureFolderName = Path.Get(System.IO.Path.GetTempPath()).Combine("Orchard.Tests.Modules.Migrations"); + private Path _tempFolderName; [TestFixtureSetUp] public void CreateDb() { @@ -51,9 +53,13 @@ namespace Orchard.Tests.Modules.Migrations { typeof(ContentItemRecord), typeof(ContentTypeRecord)}; - var databaseFileName = System.IO.Path.GetTempFileName(); + _tempFolderName = _tempFixtureFolderName.Combine(System.IO.Path.GetRandomFileName()); + try { + _tempFixtureFolderName.Delete(true); + } catch {} + _tempFixtureFolderName.CreateDirectory(); _sessionFactory = DataUtility.CreateSessionFactory( - databaseFileName, types); + _tempFolderName, types); var builder = new ContainerBuilder(); _folders = new StubFolders(); @@ -65,7 +71,7 @@ namespace Orchard.Tests.Modules.Migrations { }); builder.RegisterInstance(new ShellSettings { Name = "Default", DataTablePrefix = "TEST", DataProvider = "SqlCe" }); - builder.RegisterInstance(AppDataFolderTests.CreateAppDataFolder(Path.GetDirectoryName(databaseFileName))).As(); + builder.RegisterInstance(AppDataFolderTests.CreateAppDataFolder(_tempFixtureFolderName)).As(); builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterInstance(manager).As(); @@ -95,6 +101,12 @@ Features: "); } + [TestFixtureTearDown] + public void Term() { + try { _tempFixtureFolderName.Delete(true); } + catch { } + } + public class StubFolders : IExtensionFolders { public StubFolders() { Manifests = new Dictionary(); diff --git a/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj b/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj index 90b750de2..48695f518 100644 --- a/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj +++ b/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj @@ -69,6 +69,9 @@ False ..\..\lib\fluentnhibernate\FluentNHibernate.dll + + ..\..\lib\fluentpath\FluentPath.dll + False ..\..\lib\dlr\IronRuby.dll diff --git a/src/Orchard.Tests.Modules/Scripting/ScriptingTests.cs b/src/Orchard.Tests.Modules/Scripting/ScriptingTests.cs index fd4a7142d..0ef9cb5e6 100644 --- a/src/Orchard.Tests.Modules/Scripting/ScriptingTests.cs +++ b/src/Orchard.Tests.Modules/Scripting/ScriptingTests.cs @@ -6,14 +6,16 @@ using Autofac; using ClaySharp; using NUnit.Framework; using Orchard.Scripting.Services; +using Path = Bleroy.FluentPath.Path; -namespace Orchard.Tests.Scripting { +namespace Orchard.Tests.Modules.Scripting { [TestFixture] public class ScriptingTests { private IContainer _container; private IScriptingRuntime _scriptingRuntime; private IScriptingManager _scriptingManager; - private string _tempFolderName; + private readonly Path _tempFixtureFolderName = Path.Get(System.IO.Path.GetTempPath()).Combine("Orchard.Tests.Modules.Scripting"); + private Path _tempFolderName; [SetUp] public void Init() { @@ -23,14 +25,18 @@ namespace Orchard.Tests.Scripting { _container = builder.Build(); _scriptingRuntime = _container.Resolve(); _scriptingManager = _container.Resolve(); - _tempFolderName = Path.GetTempFileName(); - File.Delete(_tempFolderName); - Directory.CreateDirectory(_tempFolderName); + _tempFolderName = _tempFixtureFolderName.Combine(System.IO.Path.GetRandomFileName()); + try { + _tempFolderName.Delete(); + } + catch { } + _tempFolderName.CreateDirectory(); } [TearDown] public void Term() { - Directory.Delete(_tempFolderName, true); + try { _tempFixtureFolderName.Delete(true); } + catch { } } [Test] @@ -71,7 +77,7 @@ namespace Orchard.Tests.Scripting { [Test] public void ScriptingManagerCanExecuteFile() { - var targetPath = Path.Combine(_tempFolderName, "SampleMethodDefinition.rb"); + var targetPath = _tempFolderName.Combine("SampleMethodDefinition.rb"); File.WriteAllText(targetPath, "def f\r\nreturn 32\r\nend\r\n"); _scriptingManager.ExecuteFile(targetPath); Assert.That(_scriptingManager.ExecuteExpression("f / 4"), Is.EqualTo(8)); @@ -95,7 +101,7 @@ namespace Orchard.Tests.Scripting { [Test] public void CanDeclareCallbackOnInstanceEvalWithFile() { - var targetPath = Path.Combine(_tempFolderName, "CallbackOnInstanceEval.rb"); + var targetPath = _tempFolderName.Combine("CallbackOnInstanceEval.rb"); File.WriteAllText(targetPath, "class ExecContext\r\ndef initialize(callbacks)\r\n@callbacks = callbacks;\r\nend\r\ndef execute(text)\r\ninstance_eval(text.to_s);\r\nend\r\ndef method_missing(name, *args, &block)\r\n@callbacks.send(name, args, &block);\r\nend\r\nend\r\ndef execute(&block)\r\nExecContext.new(callbacks).instance_eval(&block);\r\nend\r\n"); _scriptingManager.ExecuteFile(targetPath); _scriptingManager.SetVariable("callbacks", new CallbackApi());