Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Commit

Permalink
test(behat): Add acceptance test for security requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
DDEV-Local User authored and WidgetsBurritos committed Aug 10, 2020
1 parent 3eaf92a commit f957642
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions features/drupal/my-message.feature
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 |

0 comments on commit f957642

Please sign in to comment.