This repository has been archived by the owner on Dec 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(behat): Add acceptance test for security requirements
- Loading branch information
1 parent
3eaf92a
commit f957642
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
Feature: My Message | ||
|
||
Verify that the "My Message" route correctly handles user roles. | ||
|
||
Scenario: Verified unauthenticated users | ||
Given I am on "/my-message" | ||
Then the response status code should be 403 | ||
And the response should contain "You are not authorized to access this page." | ||
And the response should not contain "You are logged in" | ||
And the response should not contain "You are special" | ||
And the response should not contain "You have yet another privilege" | ||
|
||
@api | ||
Scenario: Verify users with "my super secret privilege" | ||
Given I am logged in as a user with the "my super secret privilege" permission | ||
And I am on "/my-message" | ||
Then the response status code should be 200 | ||
And the response should contain "You are logged in" | ||
And the response should contain "You are special" | ||
And the response should not contain "You have yet another privilege" | ||
|
||
@api | ||
Scenario: Verify users with "yet another privilege" | ||
Given I am logged in as a user with the "yet another privilege" permission | ||
And I am on "/my-message" | ||
Then the response status code should be 200 | ||
And the response should contain "You are logged in" | ||
And the response should not contain "You are special" | ||
And the response should contain "You have yet another privilege" | ||
|
||
|
||
# CONSOLIDATED RULE FOR ALL 200 status permissions: | ||
|
||
@api | ||
Scenario Outline: | ||
Given I am logged in as a user with the "<permission>" permission | ||
And I am on "/my-message" | ||
Then the response status code should be 200 | ||
And the response should <logged in> "You are logged in" | ||
And the response should <special> "You are special" | ||
And the response should <yet another> "You have yet another privilege" | ||
|
||
Scenarios: | ||
| permission | logged in | special | yet another | | ||
| access content | contain | not contain | not contain | | ||
| my super secret privilege | contain | contain | not contain | | ||
| yet another privilege | contain | not contain | contain | | ||
| my super secret privilege, yet another privilege | contain | contain | contain | |