[Pywikipedia-l] SVN: [4759] branches/rewrite/pywikibot

russblau at svn.wikimedia.org russblau at svn.wikimedia.org
Wed Dec 26 15:57:59 UTC 2007


Revision: 4759
Author:   russblau
Date:     2007-12-26 15:57:59 +0000 (Wed, 26 Dec 2007)

Log Message:
-----------
Add tests directory and dummy objects for use in developing and running unit tests.

Added Paths:
-----------
    branches/rewrite/pywikibot/tests/
    branches/rewrite/pywikibot/tests/dummy.py

Added: branches/rewrite/pywikibot/tests/dummy.py
===================================================================
--- branches/rewrite/pywikibot/tests/dummy.py	                        (rev 0)
+++ branches/rewrite/pywikibot/tests/dummy.py	2007-12-26 15:57:59 UTC (rev 4759)
@@ -0,0 +1,37 @@
+# -*- coding: utf-8  -*-
+"""Dummy objects for use in unit tests."""
+#
+# (C) Pywikipedia bot team, 2007
+#
+# Distributed under the terms of the MIT license.
+#
+__version__ = '$Id: $'
+
+# add in any other attributes or methods that are needed for testing
+
+class TestSite(object):
+    """Mimic a Site object."""
+    def __init__(self, hostname, protocol="http"):
+        self._hostname = hostname
+        self._protocol = protocol
+    def protocol(self):
+        return self._protocol
+    def hostname(self):
+        return self._hostname
+    def cookies(self, sysop=False):
+        if hasattr(self, "_cookies"):
+            return self._cookies
+        return u""
+
+
+class TestPage(object):
+    """Mimic a Page object."""
+    def __init__(self, site, title):
+        self._site = site
+        self._title = title
+
+    def site(self):
+        return self._site
+    def title(self):
+        return self._title
+    





More information about the Pywikipedia-l mailing list