entity-command/features/user-reset-password.feature
David E. Smith ca979c45cc
Add --show-password flag to user reset-password (#394)
* First draft of password reset flag to show new pass

* Correct indentation on feature test

* Add --porcelain flag for user reset-password

* Test for --porcelain

* PHPCS corrections

* PHPCS assignment alignment fix

* Fix feature test formatting

* Update README.md

---------

Co-authored-by: David E. Smith <109608083+dsmith4-godaddy@users.noreply.github.com>
Co-authored-by: Daniel Bachhuber <daniel.bachhuber@automattic.com>
2023-05-18 03:23:46 -07:00

80 lines
2.1 KiB
Gherkin

Feature: Reset passwords for one or more WordPress users.
@require-wp-4.3
Scenario: Reset the password of a WordPress user
Given a WP installation
When I run `wp user get 1 --field=user_pass`
Then save STDOUT as {ORIGINAL_PASSWORD}
When I run `wp user reset-password 1`
Then STDOUT should contain:
"""
Reset password for admin.
Success: Password reset for 1 user.
"""
And an email should be sent
When I run `wp user get 1 --field=user_pass`
Then STDOUT should not contain:
"""
{ORIGINAL_PASSWORD}
"""
@require-wp-4.3
Scenario: Reset the password of a WordPress user, but skip emailing them
Given a WP installation
When I run `wp user get 1 --field=user_pass`
Then save STDOUT as {ORIGINAL_PASSWORD}
When I run `wp user reset-password 1 --skip-email`
Then STDOUT should contain:
"""
Reset password for admin.
Success: Password reset for 1 user.
"""
And an email should not be sent
When I run `wp user get 1 --field=user_pass`
Then STDOUT should not contain:
"""
{ORIGINAL_PASSWORD}
"""
@require-wp-4.3
Scenario: Reset the password of a WordPress user, and show the new password
Given a WP installation
When I run `wp user get 1 --field=user_pass`
Then save STDOUT as {ORIGINAL_PASSWORD}
When I run `wp user reset-password 1 --skip-email --show-password`
Then STDOUT should contain:
"""
Password:
"""
And an email should not be sent
When I run `wp user get 1 --field=user_pass`
Then STDOUT should not contain:
"""
{ORIGINAL_PASSWORD}
"""
@require-wp-4.3
Scenario: Reset the password of a WordPress user, and show only the new password
Given a WP installation
When I run `wp user get 1 --field=user_pass`
Then save STDOUT as {ORIGINAL_PASSWORD}
When I run `wp user reset-password 1 --skip-email --porcelain`
Then STDOUT should not be empty
And an email should not be sent
When I run `wp user get 1 --field=user_pass`
Then STDOUT should not contain:
"""
{ORIGINAL_PASSWORD}
"""