Commit 06899ef1 authored by Sigmund Augdal's avatar Sigmund Augdal

Fix unit tests

parent bfc15419
......@@ -117,7 +117,7 @@ class TestGetGroupMembers(object):
def setup(self):
self.etcd = mock.MagicMock()
self.members = MockEtcdValue("")
self.etcd.get = mock.MagicMock(return_value=self.members)
self.etcd.read = mock.MagicMock(return_value=self.members)
def test_no_members(self):
raw, members = security_groups.get_group_members(self.etcd, sec_group)
......@@ -137,13 +137,13 @@ class TestGetGroupMembers(object):
assert members == ["aa:bb:cc:dd:ee:ff", "11:22:33:44:55:66"]
def test_no_key(self):
self.etcd.get = mock.MagicMock(side_effect=KeyError("Key Not Found"))
self.etcd.read = mock.MagicMock(side_effect=KeyError("Key Not Found"))
raw, members = security_groups.get_group_members(self.etcd, sec_group)
assert raw is None
assert members == []
def test_raises_other_errors(self):
self.etcd.get = mock.MagicMock(side_effect=etcd.EtcdException("Ugle Key Not Found"))
self.etcd.read = mock.MagicMock(side_effect=etcd.EtcdException("Ugle Key Not Found"))
with raises(etcd.EtcdException):
raw, members = security_groups.get_group_members(self.etcd, sec_group)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment