jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/505461 )
Change subject: [TEST] add tests for new create_short_link() ......................................................................
[TEST] add tests for new create_short_link()
Bug: T220876 Change-Id: Ia6ecb56a72457e9748873b66bee013f7142827df --- M tests/page_tests.py 1 file changed, 16 insertions(+), 0 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/page_tests.py b/tests/page_tests.py index 4f361ce..f538463 100644 --- a/tests/page_tests.py +++ b/tests/page_tests.py @@ -1175,6 +1175,22 @@ 'Framawiki%2Fpwb_tests%2Fpermalink&oldid=340685')
+class TestShortLink(DefaultSiteTestCase): + """Test that short link management is correct.""" + + family = 'test' + code = 'test' + + def test_create_short_link(self): + """Test create_short_link function.""" + site = self.get_site() + p1 = pywikibot.Page(site, 'User:Framawiki/pwb_tests/shortlink') + self.assertEqual(p1.create_short_link(), 'w.wiki/3Cy') + self.assertEqual(p1.create_short_link(with_protocol=True), + 'https://w.wiki/3Cy') + self.assertEqual(p1.create_short_link(permalink=True), 'w.wiki/3Cz') + + if __name__ == '__main__': # pragma: no cover try: unittest.main()