commit c66063cc7c3612a7d60778efa429d37cfcbc4445 Author: Arturo Filastò art@fuffa.org Date: Tue Sep 10 13:36:40 2013 +0200
Write unittest for testing https://github.com/TheTorProject/ooni-backend/pull/16 --- ooni/tests/test_oonibclient.py | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/ooni/tests/test_oonibclient.py b/ooni/tests/test_oonibclient.py index aef48b7..b5957c4 100644 --- a/ooni/tests/test_oonibclient.py +++ b/ooni/tests/test_oonibclient.py @@ -78,11 +78,20 @@ class TestOONIBClient(unittest.TestCase): ]), e.CouldNotFindTestHelper)
@defer.inlineCallbacks + def test_lookup_no_test_helpers(self): + self.oonibclient.address = 'http://127.0.0.1:8888' + required_helpers = [] + helpers = yield self.oonibclient.lookupTestHelpers(required_helpers) + self.assertTrue('default' in helpers.keys()) + + @defer.inlineCallbacks def test_lookup_test_helpers(self): self.oonibclient.address = 'http://127.0.0.1:8888' required_helpers = [u'http-return-json-headers', u'dns'] helpers = yield self.oonibclient.lookupTestHelpers(required_helpers) self.assertEqual(set(helpers.keys()), set(required_helpers + [u'default'])) + self.assertTrue(helpers['http-return-json-headers']['address'].startswith('http')) + self.assertTrue(int(helpers['dns']['address'].split('.')[0]))
@defer.inlineCallbacks def test_invalid_requests(self):
tor-commits@lists.torproject.org