[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [bridgedb/develop] Add unittests for bridgedb.bridgerequest.
commit 1e7e8324ddb113920348990172e194440f322f55
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date: Thu Aug 21 02:42:14 2014 +0000
Add unittests for bridgedb.bridgerequest.
---
lib/bridgedb/test/test_bridgerequest.py | 44 +++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/lib/bridgedb/test/test_bridgerequest.py b/lib/bridgedb/test/test_bridgerequest.py
new file mode 100644
index 0000000..1db8814
--- /dev/null
+++ b/lib/bridgedb/test/test_bridgerequest.py
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+#_____________________________________________________________________________
+#
+# This file is part of BridgeDB, a Tor bridge distribution system.
+#
+# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@xxxxxxxxxxxxxx>
+# please also see AUTHORS file
+# :copyright: (c) 2007-2014, The Tor Project, Inc.
+# (c) 2014, Isis Lovecruft
+# :license: see LICENSE for licensing information
+#_____________________________________________________________________________
+
+
+from twisted.trial import unittest
+
+from bridgedb import bridgerequest
+from bridgedb.bridgerequest import IBridgeRequest
+from bridgedb.bridgerequest import BridgeRequestBase
+
+
+class BridgeRequestBaseTests(unittest.TestCase):
+ """Unittests for :class:`bridgedb.bridgerequest.BridgeRequestBase`."""
+
+ def setUp(self):
+ """Setup test run."""
+ self.request = BridgeRequestBase()
+
+ def test_BridgeRequestBase_implements_IRequestBridges(self):
+ """BridgeRequestBase should implement IRequestBridges interface."""
+ self.assertTrue(IBridgeRequest.implementedBy(BridgeRequestBase))
+
+ def test_BridgeRequestBase_withoutBlockInCountry(self):
+ """BridgeRequestBase.withoutBlockInCountry() should add the country CC
+ to the ``notBlockedIn`` attribute.
+ """
+ self.request.withoutBlockInCountry('US')
+ self.assertIn('US', self.request.notBlockedIn)
+
+ def test_BridgeRequestBase_withPluggableTransportType(self):
+ """BridgeRequestBase.withPluggableTransportType() should add the
+ pluggable transport type to the ``transport`` attribute.
+ """
+ self.request.withPluggableTransportType('huggable-transport')
+ self.assertIn('huggable-transport', self.request.transports)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits