Updating some SpecFlow tests including fixing and extending one of the blog tests (for live writer)

Also updated SendKnownResponseHeader to pick up the Content-Type

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-11-18 10:24:26 -08:00
parent 5ab8e1e9f1
commit 8956dcb5f5
8 changed files with 51 additions and 28 deletions

View File

@@ -1,9 +1,9 @@
Feature: The Admin side of the app
In order to manage my site
As a privileged user
I want to not have my cheese moved in the admin
Scenario: The current version of Orchard is displayed in the admin
Feature: The Admin side of the app
In order to manage my site
As a privileged user
I want to not have my cheese moved in the admin
Scenario: The current version of Orchard is displayed in the admin
Given I have installed Orchard
When I go to "admin"
Then I should see "<div id="orchard-version">Orchard v(?:\.\d+){2,4}</div>"
Then I should see "<div id="orchard-version">Orchard v(?:\.\d+){2,4}</div>"

View File

@@ -30,8 +30,8 @@ namespace Orchard.Specs
public virtual void FeatureSetup()
{
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "The Admin side of the app", "In order to manage my site\nAs a privileged user\nI want to not have my cheese move" +
"d in the admin", GenerationTargetLanguage.CSharp, ((string[])(null)));
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "The Admin side of the app", "In order to manage my site\r\nAs a privileged user\r\nI want to not have my cheese mo" +
"ved in the admin", GenerationTargetLanguage.CSharp, ((string[])(null)));
testRunner.OnFeatureStart(featureInfo);
}

View File

@@ -233,6 +233,11 @@ namespace Orchard.Specs.Bindings {
Assert.That(Details.StatusDescription, Is.EqualTo(statusDescription));
}
[Then(@"the content type should be ""(.*)""")]
public void ThenTheContentTypeShouldBe(string contentType) {
Assert.That(Details.ResponseHeaders["Content-Type"], Is.StringMatching(contentType));
}
[Then(@"I should see ""(.*)""")]
public void ThenIShouldSee(string text) {
Assert.That(Details.ResponseText, Is.StringMatching(text));

View File

@@ -1,4 +1,4 @@
Feature: Blog management
Feature: Blog
In order to add blogs to my site
As an author
I want to create blogs and create, publish and edit blog posts
@@ -121,4 +121,8 @@ Scenario: Enabling remote blog publishing inserts the appropriate metaweblogapi
| Routable.Title | My Blog |
And I hit "Save"
And I go to "my-blog"
Then I should see "<link href="[^"]+my-blog/wlwmanifest\.xml" rel="wlwmanifest" type="application/wlwmanifest\+xml" />"
Then I should see "<link href="[^"]*/XmlRpc/LiveWriter/Manifest" rel="wlwmanifest" type="application/wlwmanifest\+xml" />"
When I go to "/XmlRpc/LiveWriter/Manifest"
Then the content type should be "\btext/xml\b"
And I should see "<manifest xmlns="http\://schemas\.microsoft\.com/wlw/manifest/weblog">"
And I should see "<clientType>Metaweblog</clientType>"

View File

@@ -17,8 +17,8 @@ namespace Orchard.Specs
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.4.0.0")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Blog management")]
public partial class BlogManagementFeature
[NUnit.Framework.DescriptionAttribute("Blog")]
public partial class BlogFeature
{
private static TechTalk.SpecFlow.ITestRunner testRunner;
@@ -30,7 +30,7 @@ namespace Orchard.Specs
public virtual void FeatureSetup()
{
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Blog management", "In order to add blogs to my site\r\nAs an author\r\nI want to create blogs and create" +
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Blog", "In order to add blogs to my site\r\nAs an author\r\nI want to create blogs and create" +
", publish and edit blog posts", GenerationTargetLanguage.CSharp, ((string[])(null)));
testRunner.OnFeatureStart(featureInfo);
}
@@ -378,8 +378,17 @@ this.ScenarioSetup(scenarioInfo);
#line 123
testRunner.And("I go to \"my-blog\"");
#line 124
testRunner.Then("I should see \"<link href=\"[^\"]+my-blog/wlwmanifest\\.xml\" rel=\"wlwmanifest\" type=\"" +
"application/wlwmanifest\\+xml\" />\"");
testRunner.Then("I should see \"<link href=\"[^\"]*/XmlRpc/LiveWriter/Manifest\" rel=\"wlwmanifest\" typ" +
"e=\"application/wlwmanifest\\+xml\" />\"");
#line 125
testRunner.When("I go to \"/XmlRpc/LiveWriter/Manifest\"");
#line 126
testRunner.Then("the content type should be \"\\btext/xml\\b\"");
#line 127
testRunner.And("I should see \"<manifest xmlns=\"http\\://schemas\\.microsoft\\.com/wlw/manifest/weblo" +
"g\">\"");
#line 128
testRunner.And("I should see \"<clientType>Metaweblog</clientType>\"");
#line hidden
testRunner.CollectScenarioErrors();
}

View File

@@ -112,14 +112,19 @@ namespace Orchard.Specs.Hosting {
}
public override void SendKnownResponseHeader(int index, string value) {
if (index == HeaderSetCookie) {
_details.ResponseHeaders.Add("Set-Cookie", value);
}
else if (index == HeaderLocation) {
_details.ResponseHeaders.Add("Location", value);
}
else {
_details.ResponseHeaders.Add("known header #" + index, value);
switch (index) {
case HeaderSetCookie:
_details.ResponseHeaders.Add("Set-Cookie", value);
break;
case HeaderLocation:
_details.ResponseHeaders.Add("Location", value);
break;
case HeaderContentType:
_details.ResponseHeaders.Add("Content-Type", value);
break;
default:
_details.ResponseHeaders.Add("known header #" + index, value);
break;
}
base.SendKnownResponseHeader(index, value);
}

View File

@@ -1,4 +1,4 @@
Feature: Content Page management
Feature: Pages
In order to add content pages to my site
As an author
I want to create, publish and edit pages

View File

@@ -17,8 +17,8 @@ namespace Orchard.Specs
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.4.0.0")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Content Page management")]
public partial class ContentPageManagementFeature
[NUnit.Framework.DescriptionAttribute("Pages")]
public partial class PagesFeature
{
private static TechTalk.SpecFlow.ITestRunner testRunner;
@@ -30,7 +30,7 @@ namespace Orchard.Specs
public virtual void FeatureSetup()
{
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Content Page management", "In order to add content pages to my site\r\nAs an author\r\nI want to create, publish" +
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Pages", "In order to add content pages to my site\r\nAs an author\r\nI want to create, publish" +
" and edit pages", GenerationTargetLanguage.CSharp, ((string[])(null)));
testRunner.OnFeatureStart(featureInfo);
}