Skip to content

Commit

Permalink
fix create return code checks in graph feature context
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic committed Dec 8, 2022
1 parent 51cf5b3 commit 4126c7a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tests/acceptance/features/apiGraph/createGroup.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: create group

Scenario Outline: admin user creates a group
When user "Alice" creates a group "<groupname>" using the Graph API
Then the HTTP status code should be "200"
Then the HTTP status code should be "201"
And group "<groupname>" should exist
Examples:
| groupname |
Expand Down
6 changes: 3 additions & 3 deletions tests/acceptance/features/apiGraph/createUser.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ Feature: create user
And user "<userName>" <shouldOrNot> exist
Examples:
| userName | displayName | email | password | code | shouldOrNot |
| SameDisplayName | Alice Hansen | new@example.org | containsCharacters(*:!;_+-&) | 200 | should |
| withoutPassSameEmail | without pass | alice@example.org | | 200 | should |
| name | pass with space | example@example.org | my pass | 200 | should |
| SameDisplayName | Alice Hansen | new@example.org | containsCharacters(*:!;_+-&) | 201 | should |
| withoutPassSameEmail | without pass | alice@example.org | | 201 | should |
| name | pass with space | example@example.org | my pass | 201 | should |
| nameWithCharacters(*:!;_+-&) | user | new@example.org | 123 | 400 | should not |
| withoutEmail | without email | | 123 | 400 | should not |
| Alice | same userName | new@example.org | 123 | 400 | should |
Expand Down
10 changes: 5 additions & 5 deletions tests/acceptance/features/bootstrap/GraphContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function userHasBeenEditedUsingTheGraphApi(
$displayName
);
$this->featureContext->setResponse($response);
$this->featureContext->theHttpStatusCodeShouldBe(200);
$this->featureContext->theHttpStatusCodeShouldBe(204);
}

/**
Expand Down Expand Up @@ -540,7 +540,7 @@ public function theAdminHasCreatedUser(
$email,
$displayName
);
if ($response->getStatusCode() !== 200) {
if ($response->getStatusCode() !== 201) {
$this->throwHttpException($response, "Could not create user $user");
} else {
$this->featureContext->setResponse($response);
Expand Down Expand Up @@ -600,7 +600,7 @@ public function theUserHasCreatedANewUserUsingGraphapiWithTheFollowingSettings(s
$rows = $table->getRowsHash();
$response = $this->featureContext->getResponse();

if ($response->getStatusCode() !== 200) {
if ($response->getStatusCode() !== 201) {
$this->throwHttpException($response, "Could not create user '$rows[userName]'");
}
}
Expand Down Expand Up @@ -751,7 +751,7 @@ public function userCreatesGroupUsingTheGraphApi(string $group, ?string $user =
$this->featureContext->setResponse($response);
$this->featureContext->pushToLastHttpStatusCodesArray((string) $response->getStatusCode());

if ($response->getStatusCode() === 200) {
if ($response->getStatusCode() === 201) {
$groupId = $this->featureContext->getJsonDecodedResponse($response)["id"];
$this->featureContext->addGroupToCreatedGroupsList($group, true, true, $groupId);
}
Expand All @@ -768,7 +768,7 @@ public function userCreatesGroupUsingTheGraphApi(string $group, ?string $user =
*/
public function adminHasCreatedGroupUsingTheGraphApi(string $group): array {
$result = $this->createGroup($group);
if ($result->getStatusCode() === 200) {
if ($result->getStatusCode() === 201) {
return $this->featureContext->getJsonDecodedResponse($result);
} else {
$this->throwHttpException($result, "Could not create group '$group'.");
Expand Down

0 comments on commit 4126c7a

Please sign in to comment.