forked from jrydberg/etcd-py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_etcd.py
executable file
·33 lines (26 loc) · 920 Bytes
/
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
#!/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("10.0.1.110")
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")
if __name__ == '__main__':
unittest.main()