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

Show XMLRPC error when it's broken #943

Merged
merged 5 commits into from
Nov 2, 2018

Conversation

planarvoid
Copy link
Contributor

Issue: wordpress-mobile/WordPress-Android#8459

This PR is adding one additional case when we're returning the MISSING_XMLRPC_METHOD. When we were able to scrape it from the the site, we already know the the site is wporg. In that case we shouldn't show the NO_SITE_ERROR because it is not true.

@aforcier
Copy link
Contributor

Looks good @planarvoid - how about we add a new discovery test for this case though? Looks like a site with xmlrpc.php renamed but the rsd link untouched would do the trick - I'll send you a URL you can use.

@planarvoid
Copy link
Contributor Author

@aforcier I've added the test

@aforcier
Copy link
Contributor

aforcier commented Nov 1, 2018

@planarvoid you need to add a placeholder value for TEST_WPORG_URL_DELETED_XMLRPC_PHP to tests.properties-example to keep things buildable for Travis.

@planarvoid
Copy link
Contributor Author

planarvoid commented Nov 1, 2018

@aforcier thanks! I was meaning to ask you

@Test
public void testXMLRPCForbiddenDiscoveryOnSelfHostedSiteWithMovedPhpFile() throws InterruptedException {
mUrl = BuildConfig.TEST_WPORG_URL_DELETED_XMLRPC_PHP;
mUsername = BuildConfig.TEST_WPORG_USERNAME_SH_FORBIDDEN;
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't need to define mUsername and mPassword here, they're not used (and they're also currently values for a different test site).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right of course, I see now that I've deleted them in the following test by mistake 😢

@@ -434,11 +434,24 @@ public void testXMLRPCForbiddenDiscovery() throws InterruptedException {
assertTrue(mCountDownLatch.await(TestUtils.DEFAULT_TIMEOUT_MS, TimeUnit.MILLISECONDS));
}

@Test
public void testXMLRPCForbiddenDiscoveryOnSelfHostedSiteWithMovedPhpFile() throws InterruptedException {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would maybe call this test testXMLRPCDeletedXmlrpcFileDiscovery or something like that - 'forbidden' tends to refer to the xmlrpc.php file existing, but being blocked, usually via .htaccess rules.

@aforcier
Copy link
Contributor

aforcier commented Nov 2, 2018

:shipit:!

@aforcier aforcier merged commit 0598075 into develop Nov 2, 2018
@aforcier aforcier deleted the fix/show_meaningful_error_when_xmlrpc_broken branch November 2, 2018 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants