Skip to content

Commit 526f595

Browse files
authored
Merge pull request #467 from wp-cli/fix/462-tests
Mock HTTP requests in wporg status tests
2 parents cf68e1f + d598bb8 commit 526f595

File tree

1 file changed

+56
-5
lines changed

1 file changed

+56
-5
lines changed

features/plugin-list-wporg-status.feature

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,61 @@ Feature: Check the status of plugins on WordPress.org
1313
* Version: 2.0.2
1414
*/
1515
"""
16+
And that HTTP requests to https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request%5Blocale%5D=en_US&request%5Bslug%5D=wordpress-importer will respond with:
17+
"""
18+
HTTP/1.1 200
19+
Content-Type: application/json
20+
21+
{
22+
"name": "WordPress Importer",
23+
"slug": "wordpress-importer",
24+
"last_updated": "2025-09-26 9:07pm GMT"
25+
}
26+
"""
27+
And that HTTP requests to https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request%5Blocale%5D=en_US&request%5Bslug%5D=no-longer-in-directory will respond with:
28+
"""
29+
HTTP/1.1 200
30+
Content-Type: application/json
1631
17-
When I run `wp plugin list --name=wordpress-importer --field=wporg_last_updated`
18-
Then STDOUT should not be empty
19-
And save STDOUT as {COMMIT_DATE}
32+
{
33+
error: "closed",
34+
name: "No Longer in Directory",
35+
slug: "no-longer-in-directory",
36+
description: "This plugin has been closed as of October 2, 2018 and is not available for download. This closure is permanent. Reason: Guideline Violation.",
37+
closed: true,
38+
closed_date: "2018-10-02",
39+
reason: "guideline-violation",
40+
reason_text: "Guideline Violation"
41+
}
42+
"""
43+
And that HTTP requests to https://plugins.trac.wordpress.org/log/wordpress-importer/?limit=1&mode=stop_on_copy&format=rss will respond with:
44+
"""
45+
HTTP/1.1 200
46+
Content-Type: application/rss+xml;charset=utf-8
47+
48+
<?xml version="1.0"?>
49+
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
50+
<channel>
51+
<item>
52+
<pubDate>Fri, 26 Sep 2025 21:07:26 GMT</pubDate>
53+
</item>
54+
</channel>
55+
</rss>
56+
"""
57+
And that HTTP requests to https://plugins.trac.wordpress.org/log/no-longer-in-directory/?limit=1&mode=stop_on_copy&format=rss will respond with:
58+
"""
59+
HTTP/1.1 200
60+
Content-Type: application/rss+xml;charset=utf-8
61+
62+
<?xml version="1.0"?>
63+
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
64+
<channel>
65+
<item>
66+
<pubDate>Mon, 13 Nov 2017 20:51:35 GMT</pubDate>
67+
</item>
68+
</channel>
69+
</rss>
70+
"""
2071

2172
When I run `wp plugin list --fields=name,wporg_status`
2273
Then STDOUT should be a table containing rows:
@@ -28,13 +79,13 @@ Feature: Check the status of plugins on WordPress.org
2879
When I run `wp plugin list --fields=name,wporg_last_updated`
2980
Then STDOUT should be a table containing rows:
3081
| name | wporg_last_updated |
31-
| wordpress-importer | {COMMIT_DATE} |
82+
| wordpress-importer | 2025-09-26 |
3283
| no-longer-in-directory | 2017-11-13 |
3384
| never-wporg | |
3485

3586
When I run `wp plugin list --fields=name,wporg_status,wporg_last_updated`
3687
Then STDOUT should be a table containing rows:
3788
| name | wporg_status | wporg_last_updated |
38-
| wordpress-importer | active | {COMMIT_DATE} |
89+
| wordpress-importer | active | 2025-09-26 |
3990
| no-longer-in-directory | closed | 2017-11-13 |
4091
| never-wporg | | |

0 commit comments

Comments
 (0)