def test_with_http(self): """Ensure that http:// URLs raise a ValueError.""" with self.assertRaises(ValueError) as exc: config._validate_tls_url('http://example.com') self.assertEqual(str(exc.exception), 'This setting must be a URL starting with https://.')
def test_with_http(self): """Ensure that http:// URLs raise a ValueError.""" with pytest.raises(ValueError) as exc: config._validate_tls_url('http://example.com') assert str( exc.value) == 'This setting must be a URL starting with https://.'
def test_with_https(self): """Ensure that https:// urls get converted to unicode.""" result = config._validate_tls_url('https://example.com') assert result == 'https://example.com' assert isinstance(result, str)
def test_with_https(self): """Ensure that https:// urls get converted to unicode.""" result = config._validate_tls_url('https://example.com') self.assertEqual(result, u'https://example.com') self.assertTrue(isinstance(result, six.text_type))