HomePhabricator

Fix test_unconnected and test_unconnected_with_repo

Tags
None
Referenced Files
None
Subscribers
None

Description

Fix test_unconnected and test_unconnected_with_repo

site_tests.test_unconnected:

Sometimes local site is not synchronized with data repository. In
those situations unconnected_pages may return a page that is actually
connected to wikidata and test_unconnected may fail. (T175987)

To avoid this situation, instead of confirming that unconnected pages have
no item on wikidata, only confirm that the right query is sent, i.e. with
right parameters and via UnconnectedPages.

It's Mediawiki's job to ensure the correct results when a correct request
is sent.

pagegenerators_tests.test_unconnected_with_repo:

Instead of repeating the logic of site_tests.test_unconnected, just
assert that unconnected_pages is called with right parameters.

Now that these tests are not time-dependant anymore we can cache the results.
Add cached = True to TestUnconnectedPageGenerator and put test_unconnected
in TestSiteGenerators class (which is cached).

Also no need to check for self.site.hostname() == 'test.wikipedia.org'
condition because we are not relying on the result of the related data
repositoy in these tests.

Remove unused imports.

Bug: T163619
Change-Id: I625401eb7f5ad02852f5652df706d2264dd6a6f9

Details

Provenance
DalbaAuthored on Sep 16 2017, 5:56 AM
Parents
R3347:adf7fbc94f8d: Merge "tests.aspects.TestCase.has_site_user: Support '*' as family name"
Branches
Unknown
Tags
Unknown
ChangeId
I625401eb7f5ad02852f5652df706d2264dd6a6f9

Event Timeline