John Vandenberg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263161

Change subject: starsList tests
......................................................................

starsList tests

Bug: T123150
Change-Id: I7cd2546caa2523971de554f40877501764ad5219
---
M tests/__init__.py
A tests/add_text_tests.py
M tests/cosmetic_changes_tests.py
3 files changed, 57 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/61/263161/1

diff --git a/tests/__init__.py b/tests/__init__.py
index 8d768ba..4fb3698 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -128,6 +128,7 @@
     'pwb',
     'script',
     'l10n',
+    'add_text',
     'archivebot',
     'category_bot',
     'checkimages',
diff --git a/tests/add_text_tests.py b/tests/add_text_tests.py
new file mode 100644
index 0000000..9c90ef6
--- /dev/null
+++ b/tests/add_text_tests.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+"""Test add_text bot module."""
+#
+# (C) Pywikibot team, 2016
+#
+# Distributed under the terms of the MIT license.
+#
+from __future__ import absolute_import, unicode_literals
+
+__version__ = '$Id$'
+
+import pywikibot
+
+from scripts.add_text import add_text
+
+from tests.aspects import unittest, TestCase
+
+
+class TestStarList(TestCase):
+
+    """Test starlist."""
+
+    family = 'wikipedia'
+    code = 'en'
+
+    dry = True
+
+    def test_basic(self):
+        """Test adding text before {{linkfa}} without parameters."""
+        page = pywikibot.Page(self.site, 'foo')
+        (text, newtext, always) = add_text(
+            page, 'bar', putText=False,
+            oldTextGiven='foo\n{{linkfa}}')
+        self.assertEqual(
+            'foo\n{{linkfa}}\nbar',
+            newtext)
+
+    def test_with_params(self):
+        """Test adding text before {{linkfa|...}}."""
+        page = pywikibot.Page(self.site, 'foo')
+        (text, newtext, always) = add_text(
+            page, 'bar', putText=False,
+            oldTextGiven='foo\n{{linkfa|...}}')
+        self.assertEqual(
+            'foo\nbar\n\n{{linkfa|...}}\n',
+            newtext)
+
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/tests/cosmetic_changes_tests.py b/tests/cosmetic_changes_tests.py
index 17e270d..4f01f22 100644
--- a/tests/cosmetic_changes_tests.py
+++ b/tests/cosmetic_changes_tests.py
@@ -42,6 +42,12 @@
         self.assertEqual('[[en:Foo bar]]',
                          self.cct.fixSelfInterwiki('[[en:Foo bar]]'))
 
+    def test_standardizePageFooter(self):
+        """Test standardizePageFooter method."""
+        self.assertEqual('Foo\n{{link fa}}\n\n[[Category:Foo]]',
+                         self.cct.standardizePageFooter(
+                            'Foo [[category:foo]] {{link fa}}'))
+
     def test_resolveHtmlEntities(self):
         """Test resolveHtmlEntities method."""
         self.assertEqual(

-- 
To view, visit https://gerrit.wikimedia.org/r/263161
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7cd2546caa2523971de554f40877501764ad5219
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jay...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to