mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Added MultiTenancy spec test for tenant w/ preconfigured db
- Also updated the WebAppHosting binding's form filler to select the appropriate radio input based on given value --HG-- branch : dev
This commit is contained in:
@@ -157,9 +157,26 @@ namespace Orchard.Specs.Bindings {
|
|||||||
|
|
||||||
foreach (var row in table.Rows) {
|
foreach (var row in table.Rows) {
|
||||||
var r = row;
|
var r = row;
|
||||||
var input = inputs.SingleOrDefault(x => x.GetAttributeValue("name", x.GetAttributeValue("id", "")) == r["name"]);
|
var input = inputs.First(x => x.GetAttributeValue("name", x.GetAttributeValue("id", "")) == r["name"]);
|
||||||
Assert.That(input, Is.Not.Null, "Unable to locate <input> name {0} in page html:\r\n\r\n{1}", r["name"], Details.ResponseText);
|
Assert.That(input, Is.Not.Null, "Unable to locate <input> name {0} in page html:\r\n\r\n{1}", r["name"], Details.ResponseText);
|
||||||
input.Attributes.Add("value", row["value"]);
|
var inputType = input.Attributes["type"].Value.ToLowerInvariant();
|
||||||
|
switch(inputType) {
|
||||||
|
case "radio":
|
||||||
|
var radios = inputs.Where(
|
||||||
|
x =>
|
||||||
|
x.GetAttributeValue("type", "") == "radio" &&
|
||||||
|
x.GetAttributeValue("name", x.GetAttributeValue("id", "")) == r["name"]);
|
||||||
|
foreach(var radio in radios) {
|
||||||
|
if (radio.GetAttributeValue("value", "") == row["value"])
|
||||||
|
radio.Attributes.Add("checked", "checked");
|
||||||
|
else if (radio.Attributes.Contains("checked"))
|
||||||
|
radio.Attributes.Remove("checked");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
input.Attributes.Add("value", row["value"]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,6 +220,11 @@ namespace Orchard.Specs.Bindings {
|
|||||||
Assert.That(Details.ResponseText, Is.StringContaining(text));
|
Assert.That(Details.ResponseText, Is.StringContaining(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Then(@"I should not see ""(.*)""")]
|
||||||
|
public void ThenIShouldNotSee(string text) {
|
||||||
|
Assert.That(Details.ResponseText, Is.Not.StringContaining(text));
|
||||||
|
}
|
||||||
|
|
||||||
[Then(@"the title contains ""(.*)""")]
|
[Then(@"the title contains ""(.*)""")]
|
||||||
public void ThenTheTitleContainsText(string text) {
|
public void ThenTheTitleContainsText(string text) {
|
||||||
ScenarioContext.Current.Pending();
|
ScenarioContext.Current.Pending();
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ Scenario: A new tenant is created with uninitialized state
|
|||||||
And I am redirected
|
And I am redirected
|
||||||
Then I should see "<li class="tenant Uninitialized">"
|
Then I should see "<li class="tenant Uninitialized">"
|
||||||
And the status should be 200 OK
|
And the status should be 200 OK
|
||||||
|
|
||||||
Scenario: A new tenant goes to the setup screen
|
Scenario: A new tenant goes to the setup screen
|
||||||
Given I have installed Orchard
|
Given I have installed Orchard
|
||||||
And I have installed "Orchard.MultiTenancy"
|
And I have installed "Orchard.MultiTenancy"
|
||||||
@@ -55,6 +55,23 @@ Scenario: A new tenant goes to the setup screen
|
|||||||
Then I should see "Welcome to Orchard"
|
Then I should see "Welcome to Orchard"
|
||||||
And I should see "Finish Setup"
|
And I should see "Finish Setup"
|
||||||
And the status should be 200 OK
|
And the status should be 200 OK
|
||||||
|
|
||||||
|
Scenario: A new tenant with preconfigured database goes to the setup screen
|
||||||
|
Given I have installed Orchard
|
||||||
|
And I have installed "Orchard.MultiTenancy"
|
||||||
|
When I go to "Admin/MultiTenancy/Add"
|
||||||
|
And I fill in
|
||||||
|
| name | value |
|
||||||
|
| Name | Scott |
|
||||||
|
| RequestUrlHost | scott.example.org |
|
||||||
|
| DatabaseOptions | True |
|
||||||
|
And I hit "Save"
|
||||||
|
And I am redirected
|
||||||
|
And I go to "/Setup" on host scott.example.org
|
||||||
|
Then I should see "Welcome to Orchard"
|
||||||
|
And I should see "Finish Setup"
|
||||||
|
And I should not see "SQLite"
|
||||||
|
And the status should be 200 OK
|
||||||
|
|
||||||
Scenario: A new tenant runs the setup
|
Scenario: A new tenant runs the setup
|
||||||
Given I have installed Orchard
|
Given I have installed Orchard
|
||||||
|
|||||||
84
src/Orchard.Specs/MultiTenancy.feature.cs
generated
84
src/Orchard.Specs/MultiTenancy.feature.cs
generated
@@ -202,10 +202,10 @@ this.ScenarioSetup(scenarioInfo);
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NUnit.Framework.TestAttribute()]
|
[NUnit.Framework.TestAttribute()]
|
||||||
[NUnit.Framework.DescriptionAttribute("A new tenant runs the setup")]
|
[NUnit.Framework.DescriptionAttribute("A new tenant with preconfigured database goes to the setup screen")]
|
||||||
public virtual void ANewTenantRunsTheSetup()
|
public virtual void ANewTenantWithPreconfiguredDatabaseGoesToTheSetupScreen()
|
||||||
{
|
{
|
||||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant runs the setup", ((string[])(null)));
|
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant with preconfigured database goes to the setup screen", ((string[])(null)));
|
||||||
#line 59
|
#line 59
|
||||||
this.ScenarioSetup(scenarioInfo);
|
this.ScenarioSetup(scenarioInfo);
|
||||||
#line 60
|
#line 60
|
||||||
@@ -224,31 +224,77 @@ this.ScenarioSetup(scenarioInfo);
|
|||||||
table4.AddRow(new string[] {
|
table4.AddRow(new string[] {
|
||||||
"RequestUrlHost",
|
"RequestUrlHost",
|
||||||
"scott.example.org"});
|
"scott.example.org"});
|
||||||
|
table4.AddRow(new string[] {
|
||||||
|
"DatabaseOptions",
|
||||||
|
"True"});
|
||||||
#line 63
|
#line 63
|
||||||
testRunner.And("I fill in", ((string)(null)), table4);
|
testRunner.And("I fill in", ((string)(null)), table4);
|
||||||
#line 67
|
|
||||||
testRunner.And("I hit \"Save\"");
|
|
||||||
#line 68
|
#line 68
|
||||||
|
testRunner.And("I hit \"Save\"");
|
||||||
|
#line 69
|
||||||
|
testRunner.And("I am redirected");
|
||||||
|
#line 70
|
||||||
testRunner.And("I go to \"/Setup\" on host scott.example.org");
|
testRunner.And("I go to \"/Setup\" on host scott.example.org");
|
||||||
|
#line 71
|
||||||
|
testRunner.Then("I should see \"Welcome to Orchard\"");
|
||||||
|
#line 72
|
||||||
|
testRunner.And("I should see \"Finish Setup\"");
|
||||||
|
#line 73
|
||||||
|
testRunner.And("I should not see \"SQLite\"");
|
||||||
|
#line 74
|
||||||
|
testRunner.And("the status should be 200 OK");
|
||||||
|
#line hidden
|
||||||
|
testRunner.CollectScenarioErrors();
|
||||||
|
}
|
||||||
|
|
||||||
|
[NUnit.Framework.TestAttribute()]
|
||||||
|
[NUnit.Framework.DescriptionAttribute("A new tenant runs the setup")]
|
||||||
|
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");
|
||||||
|
#line 78
|
||||||
|
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
|
||||||
|
#line 79
|
||||||
|
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
|
||||||
#line hidden
|
#line hidden
|
||||||
TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
|
TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
|
||||||
"name",
|
"name",
|
||||||
"value"});
|
"value"});
|
||||||
table5.AddRow(new string[] {
|
table5.AddRow(new string[] {
|
||||||
|
"Name",
|
||||||
|
"Scott"});
|
||||||
|
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 85
|
||||||
|
testRunner.And("I go to \"/Setup\" on host scott.example.org");
|
||||||
|
#line hidden
|
||||||
|
TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] {
|
||||||
|
"name",
|
||||||
|
"value"});
|
||||||
|
table6.AddRow(new string[] {
|
||||||
"SiteName",
|
"SiteName",
|
||||||
"Scott Site"});
|
"Scott Site"});
|
||||||
table5.AddRow(new string[] {
|
table6.AddRow(new string[] {
|
||||||
"AdminPassword",
|
"AdminPassword",
|
||||||
"6655321"});
|
"6655321"});
|
||||||
#line 69
|
#line 86
|
||||||
testRunner.And("I fill in", ((string)(null)), table5);
|
testRunner.And("I fill in", ((string)(null)), table6);
|
||||||
#line 73
|
#line 90
|
||||||
testRunner.And("I hit \"Finish Setup\"");
|
testRunner.And("I hit \"Finish Setup\"");
|
||||||
#line 74
|
#line 91
|
||||||
testRunner.And("I go to \"/Default.aspx\"");
|
testRunner.And("I go to \"/Default.aspx\"");
|
||||||
#line 75
|
#line 92
|
||||||
testRunner.Then("I should see \"<h1>Scott Site</h1>\"");
|
testRunner.Then("I should see \"<h1>Scott Site</h1>\"");
|
||||||
#line 76
|
#line 93
|
||||||
testRunner.And("I should see \"Welcome, <strong>admin</strong>!\"");
|
testRunner.And("I should see \"Welcome, <strong>admin</strong>!\"");
|
||||||
#line hidden
|
#line hidden
|
||||||
testRunner.CollectScenarioErrors();
|
testRunner.CollectScenarioErrors();
|
||||||
@@ -259,19 +305,19 @@ this.ScenarioSetup(scenarioInfo);
|
|||||||
public virtual void ListingTenantsFromCommandLine()
|
public virtual void ListingTenantsFromCommandLine()
|
||||||
{
|
{
|
||||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Listing tenants from command line", ((string[])(null)));
|
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Listing tenants from command line", ((string[])(null)));
|
||||||
#line 78
|
#line 95
|
||||||
this.ScenarioSetup(scenarioInfo);
|
this.ScenarioSetup(scenarioInfo);
|
||||||
#line 79
|
#line 96
|
||||||
testRunner.Given("I have installed Orchard");
|
testRunner.Given("I have installed Orchard");
|
||||||
#line 80
|
#line 97
|
||||||
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
|
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
|
||||||
#line 81
|
#line 98
|
||||||
testRunner.And("I have tenant \"Alpha\" on \"example.org\" as \"New-site-name\"");
|
testRunner.And("I have tenant \"Alpha\" on \"example.org\" as \"New-site-name\"");
|
||||||
#line 82
|
#line 99
|
||||||
testRunner.When("I execute >tenant list");
|
testRunner.When("I execute >tenant list");
|
||||||
#line 83
|
#line 100
|
||||||
testRunner.Then("I should see \"Name: Alpha\"");
|
testRunner.Then("I should see \"Name: Alpha\"");
|
||||||
#line 84
|
#line 101
|
||||||
testRunner.And("I should see \"Request Url Host: example.org\"");
|
testRunner.And("I should see \"Request Url Host: example.org\"");
|
||||||
#line hidden
|
#line hidden
|
||||||
testRunner.CollectScenarioErrors();
|
testRunner.CollectScenarioErrors();
|
||||||
|
|||||||
Reference in New Issue
Block a user