-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathsite-generate.feature
More file actions
107 lines (95 loc) · 3.38 KB
/
site-generate.feature
File metadata and controls
107 lines (95 loc) · 3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Feature: Generate new WordPress sites
Scenario: Generate on single site
Given a WP install
When I try `wp site generate`
Then STDERR should contain:
"""
This is not a multisite installation.
"""
And STDOUT should be empty
And the return code should be 1
Scenario: Generate a specific number of sites
Given a WP multisite install
When I run `wp site generate --count=10`
And I run `wp site list --format=count`
Then STDOUT should be:
"""
11
"""
Scenario: Generate sites assigned to a specific network
Given a WP multisite install
When I try `wp site generate --count=4 --network_id=2`
Then STDERR should contain:
"""
Network with id 2 does not exist.
"""
And STDOUT should be empty
And the return code should be 1
Scenario: Generate sites and output ids
Given a WP multisite install
When I run `wp site generate --count=3 --format=ids`
And I run `wp site list --format=ids`
Then STDOUT should be:
"""
1 2 3 4
"""
And STDERR should be empty
And the return code should be 0
Scenario: Generate subdomain sites
Given a WP multisite subdomain install
When I run `wp site generate --count=1`
Then STDOUT should be empty
When I run `wp site list --fields=blog_id,url`
Then STDOUT should be a table containing rows:
| blog_id | url |
| 1 | https://example.com/ |
| 2 | http://site1.example.com/ |
When I run `wp site list --format=ids`
Then STDOUT should be:
"""
1 2
"""
Scenario: Generate subdirectory sites
Given a WP multisite subdirectory install
When I run `wp site generate --count=1`
Then STDOUT should be empty
And I run `wp site list --site__in=2 --field=url | sed -e's,^\(.*\)://.*,\1,g'`
And save STDOUT as {SCHEME}
When I run `wp site list --fields=blog_id,url`
Then STDOUT should be a table containing rows:
| blog_id | url |
| 1 | https://example.com/ |
| 2 | {SCHEME}://example.com/site1/ |
When I run `wp site list --format=ids`
Then STDOUT should be:
"""
1 2
"""
Scenario: Generate sites with a slug
Given a WP multisite subdirectory install
When I run `wp site generate --count=2 --slug=subsite`
Then STDOUT should be empty
And I run `wp site list --site__in=2 --field=url | sed -e's,^\(.*\)://.*,\1,g'`
And save STDOUT as {SCHEME1}
And I run `wp site list --site__in=3 --field=url | sed -e's,^\(.*\)://.*,\1,g'`
And save STDOUT as {SCHEME2}
When I run `wp site list --fields=blog_id,url`
Then STDOUT should be a table containing rows:
| blog_id | url |
| 1 | https://example.com/ |
| 2 | {SCHEME1}://example.com/subsite1/ |
| 3 | {SCHEME2}://example.com/subsite2/ |
When I run `wp site list --format=ids`
Then STDOUT should be:
"""
1 2 3
"""
Scenario: Generate sites with reserved slug
Given a WP multisite subdirectory install
When I try `wp site generate --count=2 --slug=page`
Then STDERR should contain:
"""
The following words are reserved and cannot be used as blog names: page, comments, blog, files, feed
"""
And STDOUT should be empty
And the return code should be 1