def test_cluster_changed(self, configs):
     configs.complete_contexts = MagicMock()
     configs.complete_contexts.return_value = ['cluster']
     configs.write = MagicMock()
     relations.cluster_changed()
     self.assertEquals([call('/etc/glance/glance-api.conf'),
                        call('/etc/haproxy/haproxy.cfg')],
                       configs.write.call_args_list)
 def test_cluster_changed(self, configs):
     self.test_config.set('prefer-ipv6', False)
     configs.complete_contexts = MagicMock()
     configs.complete_contexts.return_value = ['cluster']
     configs.write = MagicMock()
     relations.cluster_changed()
     self.assertEqual([call('/etc/glance/glance-api.conf'),
                       call('/etc/haproxy/haproxy.cfg')],
                      configs.write.call_args_list)
 def test_cluster_changed_with_ipv6(self, configs, relation_set,
                                    _canonical_url):
     self.test_config.set('prefer-ipv6', True)
     configs.complete_contexts = MagicMock()
     configs.complete_contexts.return_value = ['cluster']
     configs.write = MagicMock()
     self.get_relation_ip.return_value = '2001:db8:1::1'
     self.relation_ids.return_value = ['cluster:0']
     relations.cluster_changed()
     self.assertEqual([call('/etc/glance/glance-api.conf'),
                       call('/etc/haproxy/haproxy.cfg')],
                      configs.write.call_args_list)
 def test_cluster_changed_with_ipv6(self, configs, relation_set,
                                    _canonical_url):
     self.test_config.set('prefer-ipv6', True)
     configs.complete_contexts = MagicMock()
     configs.complete_contexts.return_value = ['cluster']
     configs.write = MagicMock()
     self.get_relation_ip.return_value = '2001:db8:1::1'
     self.relation_ids.return_value = ['cluster:0']
     relations.cluster_changed()
     self.assertEqual([call('/etc/glance/glance-api.conf'),
                       call('/etc/haproxy/haproxy.cfg')],
                      configs.write.call_args_list)