forked from jrydberg/etcd-py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_etcd.py
executable file
·52 lines (38 loc) · 1.15 KB
/
test_etcd.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python
"""
Test suite for etcd-py
"""
import uuid
import unittest
import etcd
class TestEtcd(unittest.TestCase):
def setUp(self):
self.e = etcd.Etcd()
def tearDown(self):
self.e.close()
def test_crud(self):
test_key = uuid.uuid4().hex
first_value = uuid.uuid4().hex
self.assertEqual(self.e.set(test_key, first_value).prevValue, None)
self.assertEqual(self.e.get(test_key).value, first_value)
second_value = uuid.uuid4().hex
self.assertEqual(self.e.set(test_key, second_value).prevValue,
first_value)
self.assertEqual(self.e.delete(test_key).prevValue, second_value)
def test_watch(self):
test_key = uuid.uuid4().hex
test_value = uuid.uuid4().hex
self.e.set(test_key, test_value, 1)
self.assertEquals(self.e.watch(test_key).action, "DELETE")
def test_testandset(self):
pass
def test_get_recursive(self):
pass
def test_list(self):
pass
def test_machines(self):
pass
def test_leader(self):
pass
if __name__ == '__main__':
unittest.main()