Fix some specflow tests to not being ignored anymore

--HG--
branch : 1.x
This commit is contained in:
Renaud Paquay
2011-01-08 10:56:54 -08:00
parent c1e272028b
commit 83b11865eb
3 changed files with 41 additions and 45 deletions

View File

@@ -294,29 +294,22 @@ namespace Orchard.Specs.Bindings {
Assert.That(Details.ResponseHeaders["Content-Type"], Is.StringMatching(contentType)); Assert.That(Details.ResponseHeaders["Content-Type"], Is.StringMatching(contentType));
} }
[Then(@"I should see ""([^""]*)""")] [Then(@"I should see ""(.*)""")]
public void ThenIShouldSee(string text) { public void ThenIShouldSee(string text) {
Assert.That(Details.ResponseText, Is.StringMatching(text)); Assert.That(Details.ResponseText, Is.StringMatching(text));
} }
[Then(@"I should not see ""([^""]*)""")] [Then(@"I should not see ""(.*)""")]
public void ThenIShouldNotSee(string text) { public void ThenIShouldNotSee(string text) {
Assert.That(Details.ResponseText, Is.Not.StringContaining(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();
} }
[Then(@"I should be denied access when I go to ""(.*)""")]
[Then(@"I should see ""([^""]*)"" when I go to ""([^""]*)""")]
public void ThenIShouldSeeWhenIGoTo(string text, string urlPath) {
WhenIGoTo(urlPath);
ThenIShouldSee(text);
}
[Then(@"I should be denied access when I go to ""([^""]*)""")]
public void ThenIShouldBeDeniedAccessWhenIGoTo(string urlPath) { public void ThenIShouldBeDeniedAccessWhenIGoTo(string urlPath) {
WhenIGoTo(urlPath); WhenIGoTo(urlPath);
WhenIAmRedirected(); WhenIAmRedirected();

View File

@@ -1,28 +1,29 @@
Feature: Addition Feature: Addition
In order to prevent security model regressions In order to prevent security model regressions
As a user with specific permissions As a user with specific permissions
I should to be granted or denied access to various actions I should to be granted or denied access to various actions
@security @security
Scenario: Login can be automated Scenario: Login can be automated
Given I have installed Orchard Given I have installed Orchard
And I have a user "bob" with permissions "AccessFrontEnd" And I have a user "bob" with permissions "AccessFrontEnd"
When I go to "users/account/logoff" When I go to "users/account/logoff"
And I go to "users/account/logon" And I go to "users/account/logon"
And I fill in And I fill in
| name | value | | name | value |
| userNameOrEmail | bob | | userNameOrEmail | bob |
| password | qwerty123! | | password | qwerty123! |
And I hit "Sign In" And I hit "Sign In"
And I am redirected And I am redirected
Then I should see "Welcome" Then I should see "Welcome"
And I should see "bob" And I should see "bob"
@security @security
Scenario: Anonymous user can see the home page but not the dashboard Scenario: Anonymous user can see the home page but not the dashboard
Given I have installed Orchard Given I have installed Orchard
And I have a user "bob" with permissions "AccessFrontEnd" And I have a user "bob" with permissions "AccessFrontEnd"
When I sign in as "bob" When I sign in as "bob"
Then I should see "this is the homepage of your new site" when I go to "/" And I go to "/"
And I should be denied access when I go to "admin" Then I should see "this is the homepage of your new site"
And I should be denied access when I go to "admin"

View File

@@ -63,13 +63,13 @@ namespace Orchard.Specs
#line 7 #line 7
this.ScenarioSetup(scenarioInfo); this.ScenarioSetup(scenarioInfo);
#line 8 #line 8
testRunner.Given("I have installed Orchard"); testRunner.Given("I have installed Orchard");
#line 9 #line 9
testRunner.And("I have a user \"bob\" with permissions \"AccessFrontEnd\""); testRunner.And("I have a user \"bob\" with permissions \"AccessFrontEnd\"");
#line 10 #line 10
testRunner.When("I go to \"users/account/logoff\""); testRunner.When("I go to \"users/account/logoff\"");
#line 11 #line 11
testRunner.And("I go to \"users/account/logon\""); testRunner.And("I go to \"users/account/logon\"");
#line hidden #line hidden
TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] { TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
"name", "name",
@@ -81,15 +81,15 @@ this.ScenarioSetup(scenarioInfo);
"password", "password",
"qwerty123!"}); "qwerty123!"});
#line 12 #line 12
testRunner.And("I fill in", ((string)(null)), table1); testRunner.And("I fill in", ((string)(null)), table1);
#line 16 #line 16
testRunner.And("I hit \"Sign In\""); testRunner.And("I hit \"Sign In\"");
#line 17 #line 17
testRunner.And("I am redirected"); testRunner.And("I am redirected");
#line 18 #line 18
testRunner.Then("I should see \"Welcome\""); testRunner.Then("I should see \"Welcome\"");
#line 19 #line 19
testRunner.And("I should see \"bob\""); testRunner.And("I should see \"bob\"");
#line hidden #line hidden
testRunner.CollectScenarioErrors(); testRunner.CollectScenarioErrors();
} }
@@ -104,15 +104,17 @@ this.ScenarioSetup(scenarioInfo);
#line 22 #line 22
this.ScenarioSetup(scenarioInfo); this.ScenarioSetup(scenarioInfo);
#line 23 #line 23
testRunner.Given("I have installed Orchard"); testRunner.Given("I have installed Orchard");
#line 24 #line 24
testRunner.And("I have a user \"bob\" with permissions \"AccessFrontEnd\""); testRunner.And("I have a user \"bob\" with permissions \"AccessFrontEnd\"");
#line 25 #line 25
testRunner.When("I sign in as \"bob\""); testRunner.When("I sign in as \"bob\"");
#line 26 #line 26
testRunner.Then("I should see \"this is the homepage of your new site\" when I go to \"/\""); testRunner.And("I go to \"/\"");
#line 27 #line 27
testRunner.And("I should be denied access when I go to \"admin\""); testRunner.Then("I should see \"this is the homepage of your new site\"");
#line 28
testRunner.And("I should be denied access when I go to \"admin\"");
#line hidden #line hidden
testRunner.CollectScenarioErrors(); testRunner.CollectScenarioErrors();
} }