2 changed files with 23 additions and 18 deletions
@ -9,26 +9,37 @@ if sys.version_info >= (3, 5): |
|||
class TestAsyncRedisManager(unittest.TestCase): |
|||
def test_default_url(self): |
|||
self.assertEqual(asyncio_redis_manager._parse_redis_url('redis://'), |
|||
('localhost', 6379, 0)) |
|||
('localhost', 6379, None, 0)) |
|||
|
|||
def test_only_host_url(self): |
|||
self.assertEqual( |
|||
asyncio_redis_manager._parse_redis_url('redis://redis.host'), |
|||
('redis.host', 6379, 0)) |
|||
('redis.host', 6379, None, 0)) |
|||
|
|||
def test_no_db_url(self): |
|||
self.assertEqual( |
|||
asyncio_redis_manager._parse_redis_url('redis://redis.host:123/1'), |
|||
('redis.host', 123, 1)) |
|||
('redis.host', 123, None, 1)) |
|||
|
|||
def test_no_port_url(self): |
|||
self.assertEqual( |
|||
asyncio_redis_manager._parse_redis_url('redis://redis.host/1'), |
|||
('redis.host', 6379, 1)) |
|||
('redis.host', 6379, None, 1)) |
|||
|
|||
def test_password(self): |
|||
self.assertEqual( |
|||
asyncio_redis_manager._parse_redis_url('redis://:[email protected]/1'), |
|||
('redis.host', 6379, 'pw', 1)) |
|||
|
|||
def test_no_host_url(self): |
|||
self.assertRaises(ValueError, asyncio_redis_manager._parse_redis_url, |
|||
'redis://:123/1') |
|||
self.assertEqual( |
|||
asyncio_redis_manager._parse_redis_url('redis://:123/1'), |
|||
('localhost', 123, None, 1)) |
|||
|
|||
def test_no_host_password_url(self): |
|||
self.assertEqual( |
|||
asyncio_redis_manager._parse_redis_url('redis://:pw@:123/1'), |
|||
('localhost', 123, 'pw', 1)) |
|||
|
|||
def test_bad_port_url(self): |
|||
self.assertRaises(ValueError, asyncio_redis_manager._parse_redis_url, |
|||
|
Loading…
Reference in new issue