summaryrefslogtreecommitdiff
path: root/tests/test_client.py
blob: e8f79b1be5cd8d3f930c9cc57c8119f5b6f13341 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import redis


class TestClient(object):
    def test_client_equality(self):
        r1 = redis.Redis.from_url('redis://localhost:6379/9')
        r2 = redis.Redis.from_url('redis://localhost:6379/9')
        assert r1 == r2

    def test_clients_unequal_if_different_types(self):
        r = redis.Redis.from_url('redis://localhost:6379/9')
        assert r != 0

    def test_clients_unequal_if_different_hosts(self):
        r1 = redis.Redis.from_url('redis://localhost:6379/9')
        r2 = redis.Redis.from_url('redis://127.0.0.1:6379/9')
        assert r1 != r2

    def test_clients_unequal_if_different_ports(self):
        r1 = redis.Redis.from_url('redis://localhost:6379/9')
        r2 = redis.Redis.from_url('redis://localhost:6380/9')
        assert r1 != r2

    def test_clients_unequal_if_different_dbs(self):
        r1 = redis.Redis.from_url('redis://localhost:6379/9')
        r2 = redis.Redis.from_url('redis://localhost:6380/10')
        assert r1 != r2