Mpaa has uploaded a new change for review.

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

Change subject: page_tests.py: Add tests for FilePage.latest_revision_info
......................................................................

page_tests.py: Add tests for FilePage.latest_revision_info

Change-Id: I1bba341a1e884630d13a7c22f17a0d68adb54215
---
M tests/page_tests.py
1 file changed, 29 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/19/189119/1

diff --git a/tests/page_tests.py b/tests/page_tests.py
index f95bd6d..2191ce3 100644
--- a/tests/page_tests.py
+++ b/tests/page_tests.py
@@ -522,6 +522,35 @@
         self.assertTrue(page_copy.isRedirectPage())
 
 
+class TestFilePage(TestCase):
+
+    """Test FilePage.latest_revision_info.
+
+    These tests cover excetions for all properties and methods
+    in FilePgae that rely on site.loadimageinfo.
+
+    """
+
+    family = 'wikipedia'
+    code = 'test'
+
+    cached = True
+
+    def test_file_info_with_no_page(self):
+        """FilePage:latest_file_info raises NoPage for non existing pages."""
+        site = self.get_site()
+        image = pywikibot.FilePage(site, u'File:NoPage')
+        with self.assertRaises(pywikibot.NoPage):
+            print image.latest_file_info
+
+    def test_file_info_with_no_file(self):
+        """FilePage:latest_file_info raises PagerelatedError if no file is 
present."""
+        site = self.get_site()
+        image = pywikibot.FilePage(site, u'File:Test with no image')
+        with self.assertRaises(pywikibot.PageRelatedError):
+            print image.latest_file_info
+
+
 class TestPageRedirects(TestCase):
 
     """Test redirects."""

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1bba341a1e884630d13a7c22f17a0d68adb54215
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Mpaa <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to