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(IRequestBridges.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)
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(IRequestBridges.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) def test_BridgeRequestBase_getHashringPlacement_without_client(self): """BridgeRequestBase.getHashringPlacement() without a client parameter should use the default client identifier string. """ self.assertEqual(self.request.getHashringPlacement('AAAA'), 3486762050L) def test_BridgeRequestBase_getHashringPlacement_with_client(self): """BridgeRequestBase.getHashringPlacement() with a client parameter should use the client identifier string. """ self.assertEqual(self.request.getHashringPlacement('AAAA', client='you'), 2870307088L)
def setUp(self): """Setup test run.""" self.request = BridgeRequestBase()