Add new step

This commit is contained in:
amrita committed 2023-03-02 12:30:39 +05:45
1 parent d59dd4cd91
commit d6c08e1e51
3 files changed
+28 -6

No files matched your search

@@ -157,7 +157,7 @@ Feature: add users to group
| username |
| Brian |
| Carol |
And user "Alice" creates a group "grp1" using the Graph API
And user "Alice" has created a group "grp1" using the Graph API
When the administrator "Alice" adds the following users to a group "grp1" at once using the Graph API
| username |
| Brian |
@@ -184,7 +184,7 @@ Feature: add users to group
Scenario: admin tries to add multiple non-existing users to a group at once
Given the administrator has given "Alice" the role "Admin" using the settings api
And user "Alice" creates a group "grp1" using the Graph API
And user "Alice" has created a group "grp1" using the Graph API
When the administrator "Alice" tries to add the following non-existing users to a group "grp1" at once using the Graph API
| username |
| Brian |
@@ -197,7 +197,7 @@ Feature: add users to group
And these users have been created with default attributes and without skeleton files:
| username |
| Brian |
And user "Alice" creates a group "grp1" using the Graph API
And user "Alice" has created a group "grp1" using the Graph API
When the administrator "Alice" tries to add the following users to a group "grp1" at once using the Graph API
| username |
| Brian |
@@ -26,17 +26,17 @@ Feature: create group
Scenario: admin user tries to create a group that already exists
Given group "mygroup" has been created
When user "Alice" tries to create a group "mygroup" using the Graph API
And the HTTP status code should be "400"
Then the HTTP status code should be "400"
And group "mygroup" should exist
Scenario: normal user tries to create a group
Given user "Brian" has been created with default attributes and without skeleton files
When user "Brian" tries to create a group "mygroup" using the Graph API
And the HTTP status code should be "401"
Then the HTTP status code should be "401"
And group "mygroup" should not exist
Scenario: admin user tries to create a group that is the empty string
When user "Alice" tries to create a group "" using the Graph API
Then the HTTP status code should be "400"
Then the HTTP status code should be "400"
@@ -890,6 +890,28 @@ class GraphContext implements Context {
}
}
/**
* @Given /^the administrator has created a group "([^"]*)" using the Graph API$/
* @Given user :user has created a group :group using the Graph API
*
* @param string $group
* @param ?string $user
*
* @return void
* @throws Exception
* @throws GuzzleException
*/
public function userHasCreatedGroupUsingTheGraphApi(string $group, ?string $user = null): void {
$response = $this->createGroup($group, $user);
if ($response->getStatusCode() === 200) {
$groupId = $this->featureContext->getJsonDecodedResponse($response)["id"];
$this->featureContext->addGroupToCreatedGroupsList($group, true, true, $groupId);
} else {
$this->throwHttpException($response, "Could not create group '$group'.");
}
}
/**
* create group with provided data
*