-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #100 from wp-cli/patch-96
`wp user import-csv` to be able to import CSV from STDIN
- Loading branch information
Showing
3 changed files
with
71 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ node_modules/ | |
vendor/ | ||
*.zip | ||
*.tar.gz | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,3 +135,45 @@ Feature: Import users from CSV | |
| display_name | roles | | ||
| Bob Jones | contributor | | ||
| Bill Jones | administrator,author | | ||
|
||
Scenario: Importing users from STDIN | ||
Given a WP install | ||
And a users.csv file: | ||
""" | ||
user_login,user_email,display_name,role | ||
bobjones,[email protected],Bob Jones,contributor | ||
newuser1,[email protected],New User,author | ||
admin,[email protected],Existing User,administrator | ||
""" | ||
|
||
When I try `wp user import-csv -` | ||
Then STDERR should be: | ||
""" | ||
Error: Unable to read content from STDIN. | ||
""" | ||
|
||
When I run `cat users.csv | wp user import-csv -` | ||
Then STDOUT should be: | ||
""" | ||
Success: bobjones created. | ||
Success: newuser1 created. | ||
Success: admin updated. | ||
""" | ||
And an email should not be sent | ||
|
||
When I run `wp user list --format=count` | ||
Then STDOUT should be: | ||
""" | ||
3 | ||
""" | ||
|
||
When I run `wp user list --format=json` | ||
Then STDOUT should be JSON containing: | ||
""" | ||
[{ | ||
"user_login":"admin", | ||
"display_name":"Existing User", | ||
"user_email":"[email protected]", | ||
"roles":"administrator" | ||
}] | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters