def test_need_resources_on_remotes_all_false(self, relation_ids, related_units, relation_get): rdata = { 'pacemaker-remote:49': { 'pacemaker-remote/0': {'enable-resources': "false"}, 'pacemaker-remote/1': {'enable-resources': "false"}, 'pacemaker-remote/2': {'enable-resources': "false"}}} relation_ids.side_effect = lambda x: rdata.keys() related_units.side_effect = lambda x: rdata[x].keys() relation_get.side_effect = lambda x, y, z: rdata[z][y].get(x) self.assertFalse(utils.need_resources_on_remotes())
def test_need_resources_on_remotes_mix(self, relation_ids, related_units, relation_get): rdata = { 'pacemaker-remote:49': { 'pacemaker-remote/0': {'enable-resources': "true"}, 'pacemaker-remote/1': {'enable-resources': "false"}, 'pacemaker-remote/2': {'enable-resources': "true"}}} relation_ids.side_effect = lambda x: rdata.keys() related_units.side_effect = lambda x: rdata[x].keys() relation_get.side_effect = lambda x, y, z: rdata[z][y].get(x) with self.assertRaises(ValueError): self.assertTrue(utils.need_resources_on_remotes())