[Pkg-privacy-commits] [txtorcon] 66/96: Added coverage tests for create_geoip()

Jérémy Bobbio lunar at moszumanska.debian.org
Sun Sep 6 18:33:41 UTC 2015


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch master
in repository txtorcon.

commit ccbd2aa3b26eee9e75521e44126c5bb389edbfa0
Author: Sambuddha Basu <sambuddhabasu1 at gmail.com>
Date:   Sat Feb 14 09:24:57 2015 +0530

    Added coverage tests for create_geoip()
---
 test/test_util.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/test/test_util.py b/test/test_util.py
index 82c3d3a..579c0c5 100644
--- a/test/test_util.py
+++ b/test/test_util.py
@@ -47,6 +47,24 @@ class TestGeoIpDatabaseLoading(unittest.TestCase):
         from txtorcon import util
         self.assertRaises(IOError, util.create_geoip, '_missing_path_')
 
+    def test_missing_geoip_module(self):
+        "return none if geoip module is missing"
+        from txtorcon import util
+        _GeoIP = util.GeoIP
+        util.GeoIP = None
+        (fd, f) = tempfile.mkstemp()
+        ret_val = util.create_geoip(f)
+        delete_file_or_tree(f)
+        util.GeoIP = _GeoIP
+        self.assertEquals(ret_val, None)
+
+    def test_return_geoip_object(self):
+        from txtorcon import util
+        (fd, f) = tempfile.mkstemp()
+        ret_val = util.create_geoip(f)
+        delete_file_or_tree(f)
+        self.assertEquals(type(ret_val).__name__, 'GeoIP')
+
 
 class TestFindKeywords(unittest.TestCase):
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/txtorcon.git



More information about the Pkg-privacy-commits mailing list