Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F4173269
thanks_tests.py v3.0
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
darthbhyrava
Jun 17 2016, 12:37 AM
2016-06-17 00:37:40 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
thanks_tests.py v3.0
View Options
# -*- coding: utf-8 -*-
"""Test suite for the thanks script"""
#
# (C) Pywikibot team, 2016
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
import pywikibot
from scripts.thanks import thank_rev
from tests.aspects import unittest, TestCase
class TestRevThank(TestCase):
"""Test thanks for revisions."""
family = 'test'
code = 'test'
def test_thank_revision(self):
"""
Test thanks for normal revisions.
NOTE: This test relies on activity in recentchanges, and
there must make edits made before reruns of this test.
Please see https://phabricator.wikimedia.org/T137836.
"""
site = pywikibot.Site()
data = site.recentchanges(total=1)
for i in data:
rev_id = i['revid']
log_initial = site.logevents(logtype='thanks', total=1)
for x in log_initial:
initial_id = x.logid()
thank_rev(rev_id)
log_final = site.logevents(logtype='thanks', total=1)
for x in log_final:
final_id = x.logid()
self.assertNotEqual(initial_id,final_id)
if __name__ == "__main__":
unittest.main()
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3801954
Default Alt Text
thanks_tests.py v3.0 (1 KB)
Attached To
Mode
P3263 thanks_tests.py v3.0
Attached
Detach File
Event Timeline
Log In to Comment