Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P3263
thanks_tests.py v3.0
Active
Public
Actions
Authored by
darthbhyrava
on Jun 17 2016, 12:37 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
Pywikibot-Thanks
Referenced Files
F4173269: thanks_tests.py v3.0
Jun 17 2016, 12:37 AM
2016-06-17 00:37:40 (UTC+0)
Subscribers
None
# -*- 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
()
Event Timeline
darthbhyrava
created this paste.
Jun 17 2016, 12:37 AM
2016-06-17 00:37:40 (UTC+0)
darthbhyrava
mentioned this in
T137836: GSoC: Pywikibot-Thanks | Meeting 6 | 15th June
.
Jun 17 2016, 12:42 AM
2016-06-17 00:42:30 (UTC+0)
Log In to Comment