jenkins-bot has submitted this change and it was merged.
Change subject: Use default site for API tests
......................................................................
Use default site for API tests
Change-Id: I446e0a807724bd63f78237ab867b670c9a8c951a
---
M tests/api_tests.py
1 file changed, 5 insertions(+), 9 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Nullzero: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/api_tests.py b/tests/api_tests.py
index 3ff2cf6..a06e6fa 100644
--- a/tests/api_tests.py
+++ b/tests/api_tests.py
@@ -9,13 +9,11 @@
import datetime
import pywikibot
import pywikibot.data.api as api
-from tests.aspects import unittest, TestCase
+from tests.aspects import unittest, TestCase, DefaultSiteTestCase
-class TestApiFunctions(TestCase):
+class TestApiFunctions(DefaultSiteTestCase):
- family = 'wikipedia'
- code = 'en'
cached = True
def testObjectCreation(self):
@@ -119,25 +117,23 @@
self.assertEqual(len(results), 4) # total=-1 but 4 expected
-class TestCachedRequest(TestCase):
+class TestCachedRequest(DefaultSiteTestCase):
"""Test API Request caching.
This test class does not use the forced test caching.
"""
- family = 'wikipedia'
- code = 'en'
-
cached = False
def testResults(self):
mysite = self.get_site()
+ mainpage = self.get_mainpage()
# Run the cached query twice to ensure the
# data returned is equal
params = {'action': 'query',
'prop': 'info',
- 'titles': 'Main Page',
+ 'titles': mainpage.title(),
}
req = api.CachedRequest(datetime.timedelta(minutes=10),
site=mysite, **params)
--
To view, visit
https://gerrit.wikimedia.org/r/160957
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I446e0a807724bd63f78237ab867b670c9a8c951a
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Nullzero <nullzero.free(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>