Пример #1
0
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)
Пример #2
0
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)
Пример #3
0
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)
Пример #4
0
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)
Пример #5
0
 def setUp(self):
     """Setup test run."""
     self.request = BridgeRequestBase()
Пример #6
0
 def setUp(self):
     """Setup test run."""
     self.request = BridgeRequestBase()