-
-
Notifications
You must be signed in to change notification settings - Fork 595
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8cf035f
commit af81132
Showing
2 changed files
with
23 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,26 +9,37 @@ | |
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, | ||
|