def test_find_physnets(self): child = { 'key': "/networking-vpp/state/vpp0/physnets/testnet", 'value': "1", 'expiration': None, 'ttl': None, 'modifiedIndex': 5, 'createdIndex': 1, 'newKey': False, 'dir': False, } parent = { "node": { 'key': "/networking-vpp", 'value': None, 'expiration': None, 'ttl': None, 'modifiedIndex': 5, 'createdIndex': 1, 'newKey': False, 'dir': False, } } result = EtcdResult(**parent) result._children = [child] self.etcd_client.etcd_client.read.return_value = result retval = self.etcd_client.find_physnets() assert ('vpp0', 'testnet') in retval, \ "Return value should have contained ('vpp0', 'testnet')"
def test_physnet_known(self): child = { 'key': "/networking-vpp/state/vpp0/physnets/testnet", 'value': "1", 'expiration': None, 'ttl': None, 'modifiedIndex': 5, 'createdIndex': 1, 'newKey': False, 'dir': False, } parent = { "node": { 'key': "/networking-vpp", 'value': None, 'expiration': None, 'ttl': None, 'modifiedIndex': 5, 'createdIndex': 1, 'newKey': False, 'dir': False, } } result = EtcdResult(**parent) result._children = [child] host = 'vpp0' physnet = 'testnet' self.mech.communicator.etcd_client.read.return_value = result assert(self.mech.physnet_known(host, physnet) is True), \ "Return value for host [%s] and net [%s] should have been True" % ( host, physnet)