[tor-commits] [ooni-probe/master] Add check internet connectivity in DNST test (#505)

art at torproject.org art at torproject.org
Mon May 23 11:16:08 UTC 2016


commit 8f02264bbc8e32b508777d1d6f5d1e9f857a935c
Author: Arturo Filastò <arturo at filasto.net>
Date:   Wed May 18 14:50:46 2016 +0200

    Add check internet connectivity in DNST test (#505)
---
 ooni/tests/test_templates.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ooni/tests/test_templates.py b/ooni/tests/test_templates.py
index 931e052..e7452df 100644
--- a/ooni/tests/test_templates.py
+++ b/ooni/tests/test_templates.py
@@ -1,5 +1,6 @@
 from ooni.templates import httpt, dnst
 
+from ooni.tests import is_internet_connected
 from twisted.names import dns
 from twisted.internet.error import DNSLookupError
 from twisted.internet import reactor, defer, base
@@ -56,6 +57,10 @@ class TestHTTPT(unittest.TestCase):
         self.assertEqual(httpt.META_CHARSET_REGEXP.search(with_charset_html).group(1), 'iso-8859-1')
 
 class TestDNST(unittest.TestCase):
+    def setUp(self):
+        if not is_internet_connected():
+            self.skipTest("You must be connected to the internet to run this test")
+
     def test_represent_answer_a(self):
         a_record = dns.RRHeader(payload=dns.Record_A(address="1.1.1.1"),
                                 type=dns.A)





More information about the tor-commits mailing list