def test_tls_defaults_to_true(self): ably = AblyRest(token='foo') self.assertTrue(ably.options.tls, msg="Expected encryption to default to true") self.assertEqual(Defaults.tls_port, Defaults.get_port(ably.options), msg="Unexpected port mismatch")
def test_tls_can_be_disabled(self): ably = AblyRest(token='foo', tls=False) self.assertFalse(ably.options.tls, msg="Expected encryption to be False") self.assertEqual(Defaults.port, Defaults.get_port(ably.options), msg="Unexpected port mismatch")
def test_specified_tls_port(self): ably = AblyRest(token='foo', tls_port=9999, tls=True) self.assertEqual( 9999, Defaults.get_port(ably.options), msg="Unexpected port mismatch. Expected: 9999. Actual: %d" % ably.options.tls_port)
def preferred_port(self): return Defaults.get_port(self.options)
def test_tls_can_be_disabled(self): ably = AblyRest(Options(tls=False)) self.assertFalse(ably.options.tls, msg="Expected encryption to be False") self.assertEqual(Defaults.port, Defaults.get_port(ably.options), msg="Unexpected port mismatch")
def test_tls_defaults_to_true(self): ably = AblyRest() self.assertTrue(ably.options.tls, msg="Expected encryption to default to true") self.assertEqual(Defaults.tls_port, Defaults.get_port(ably.options), msg="Unexpected port mismatch")
def test_specified_port(self): ably = AblyRest(Options(port=9998, tls_port=9999)) self.assertEqual(9999, Defaults.get_port(ably.options), msg="Unexpected port mismatch. Expected: 9999. Actual: %d" % ably.options.tls_port)
def test_specified_non_tls_port(self): ably = AblyRest(token='foo', port=9998, tls=False) self.assertEqual(9998, Defaults.get_port(ably.options), msg="Unexpected port mismatch. Expected: 9999. Actual: %d" % ably.options.tls_port)
def test_tls_can_be_disabled(self): ably = AblyRest(token='foo', tls=False) assert not ably.options.tls, "Expected encryption to be False" assert Defaults.port == Defaults.get_port(ably.options), "Unexpected port mismatch"
def test_tls_defaults_to_true(self): ably = AblyRest(token='foo') assert ably.options.tls, "Expected encryption to default to true" assert Defaults.tls_port == Defaults.get_port(ably.options), "Unexpected port mismatch"
def test_specified_tls_port(self): ably = AblyRest(token='foo', tls_port=9999, tls=True) assert 9999 == Defaults.get_port(ably.options), "Unexpected port mismatch. Expected: 9999. Actual: %d" % ably.options.tls_port
def test_tls_can_be_disabled(self): ably = AblyRest(token='foo', tls=False) assert not ably.options.tls, "Expected encryption to be False" assert Defaults.port == Defaults.get_port( ably.options), "Unexpected port mismatch"
def test_tls_defaults_to_true(self): ably = AblyRest(token='foo') assert ably.options.tls, "Expected encryption to default to true" assert Defaults.tls_port == Defaults.get_port( ably.options), "Unexpected port mismatch"
def test_specified_non_tls_port(self): ably = AblyRest(token='foo', port=9998, tls=False) assert 9998 == Defaults.get_port( ably.options ), "Unexpected port mismatch. Expected: 9999. Actual: %d" % ably.options.tls_port