Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only][full-ci] adding test for deprovisioning notification using different date format #7065

Merged
merged 1 commit into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,71 @@ Feature: Deprovisioning notification
| Space Admin |
| User |
| User Light |


Scenario Outline: administrator creates a deprovisioning notification with different date formats
When the administrator creates a deprovisioning notification for date "<deprovision_date>" of format "<deprovision_date_format>"
Then the HTTP status code should be "200"
When user "Alice" lists all notifications
Then the HTTP status code should be "200"
Comment on lines +175 to +178
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of double when then use And and check both status with single step.Same apply for the down scenario.

And the JSON response should contain a notification message with the subject "Instance will be shut down and deprovisioned" and the message-details should match
nirajacharya2 marked this conversation as resolved.
Show resolved Hide resolved
"""
{
"type": "object",
"required": [
"message"
],
"properties": {
"message": {
"type": "string",
"enum": [
"Attention! The instance will be shut down and deprovisioned on <deprovision_date>. Download all your data before that date as no access past that date is possible."
]
}
}
}
"""
Examples:
| deprovision_date | deprovision_date_format |
| 2030-04-09T15:04:05.999999999+07:00 | 2006-01-02T15:04:05.999999999Z07:00 |
| 5:15PM | 3:04PM |
# with date format like `Jan _2 15:04:05`, `_` gets replaced with a space in the response.
| Jan 8 23:04:05 | Jan _2 15:04:05 |
| Jan 12 15:04:05.000000000 | Jan _2 15:04:05.000000000 |
| 2023-01-02 15:04:05 | 2006-01-02 15:04:05 |
| 2023-01-02 | 2006-01-02 |
| 18:24:55 | 15:04:05 |


Scenario Outline: administrator change a deprovisioning notification with different date formats
Given the administrator has created a deprovisioning notification
When the administrator creates a deprovisioning notification for date "<deprovision_date>" of format "<deprovision_date_format>"
Then the HTTP status code should be "200"
When user "Alice" lists all notifications
Then the HTTP status code should be "200"
And the JSON response should contain a notification message with the subject "Instance will be shut down and deprovisioned" and the message-details should match
nirajacharya2 marked this conversation as resolved.
Show resolved Hide resolved
"""
{
"type": "object",
"required": [
"message"
],
"properties": {
"message": {
"type": "string",
"enum": [
"Attention! The instance will be shut down and deprovisioned on <deprovision_date>. Download all your data before that date as no access past that date is possible."
]
}
}
}
"""
Examples:
| deprovision_date | deprovision_date_format |
| 01/02 03:04:05PM '23 -0700 | 01/02 03:04:05PM '06 -0700 |
| Mon Jan 2 15:04:05 UTC 2023 | Mon Jan _2 15:04:05 UTC 2006 |
| Mon Jan 02 15:04:05 -0700 2023 | Mon Jan 02 15:04:05 -0700 2006 |
| 02 Jan 23 15:04 -0700 | 02 Jan 06 15:04 -0700 |
| Monday, 02-Jan-23 15:04:05 UTC | Monday, 02-Jan-06 15:04:05 UTC |
| Mon, 02 Jan 2023 15:04:05 -0700 | Mon, 02 Jan 2006 15:04:05 -0700 |
| 2023-01-02T15:04:05+07:00 | 2006-01-02T15:04:05Z07:00 |
30 changes: 27 additions & 3 deletions tests/acceptance/features/bootstrap/NotificationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,13 +520,22 @@ public function clearInbucketMessages():void {
* @When user :user tries to create a deprovisioning notification
*
* @param string|null $user
* @param string|null $deprovision_date
* @param string|null $deprovision_date_format
*
* @return void
*
* @throws GuzzleException
*
* @throws JsonException
*/
public function userCreatesDeprovisioningNotification(?string $user = null):void {
public function userCreatesDeprovisioningNotification(
?string $user = null,
?string $deprovision_date = "2043-07-04T11:23:12Z",
?string $deprovision_date_format= "2006-01-02T15:04:05Z07:00"
):void {
$payload["type"] = "deprovision";
$payload["data"] = ["deprovision_date" => "2043-07-04T11:23:12Z"];

$payload["data"] = ["deprovision_date" => $deprovision_date, "deprovision_date_format" => $deprovision_date_format];
$response = OcsApiHelper::sendRequest(
$this->featureContext->getBaseUrl(),
$user ? $this->featureContext->getActualUsername($user) : $this->featureContext->getAdminUsername(),
Expand All @@ -540,6 +549,21 @@ public function userCreatesDeprovisioningNotification(?string $user = null):void
$this->featureContext->setResponse($response);
}

/**
* @When the administrator creates a deprovisioning notification for date :deprovision_date of format :deprovision_date_format
*
* @param $deprovision_date
* @param $deprovision_date_format
*
* @return void
*
* @throws GuzzleException
* @throws JsonException
*/
public function theAdministratorCreatesADeprovisioningNotificationUsingDateFormat($deprovision_date, $deprovision_date_format) {
$this->userCreatesDeprovisioningNotification(null, $deprovision_date, $deprovision_date_format);
}

/**
* @Given the administrator has created a deprovisioning notification
*
Expand Down