def test_keystone_joined_with_relation_id(self, _canonical_url):
     _canonical_url.return_value = 'http://glancehost'
     relations.keystone_joined(relation_id='identity-service:0')
     ex = {
         'region': 'RegionOne',
         'public_url': 'http://glancehost:9292',
         'admin_url': 'http://glancehost:9292',
         'service': 'glance',
         'internal_url': 'http://glancehost:9292',
         'relation_id': 'identity-service:0',
     }
     self.relation_set.assert_called_with(**ex)
 def test_keystone_joined_with_relation_id(self, _canonical_url):
     _canonical_url.return_value = 'http://glancehost'
     relations.keystone_joined(relation_id='identity-service:0')
     ex = {
         'region': 'RegionOne',
         'public_url': 'http://glancehost:9292',
         'admin_url': 'http://glancehost:9292',
         'service': 'glance',
         'internal_url': 'http://glancehost:9292',
         'relation_id': 'identity-service:0',
     }
     self.relation_set.assert_called_with(**ex)
 def test_keystone_joined(self):
     self.eligible_leader.return_value = True
     self.canonical_url.return_value = 'http://glancehost'
     relations.keystone_joined()
     ex = {
         'region': 'RegionOne',
         'public_url': 'http://glancehost:9292',
         'admin_url': 'http://glancehost:9292',
         'service': 'glance',
         'internal_url': 'http://glancehost:9292',
         'relation_id': None,
     }
     self.relation_set.assert_called_with(**ex)
 def test_keystone_joined_public_endpoint(self, _canonical_url):
     def fake_canonical_url(configs, endpoint_type):
         return {"public": "http://glance.example.com",
                 "int": "http://glancehost",
                 "admin": "http://glancehost"}[endpoint_type]
     _canonical_url.side_effect = fake_canonical_url
     self.test_config.set('os-public-hostname', 'glance.example.com')
     relations.keystone_joined()
     ex = {
         'region': 'RegionOne',
         'public_url': 'http://glance.example.com:9292',
         'admin_url': 'http://glancehost:9292',
         'service': 'glance',
         'internal_url': 'http://glancehost:9292',
         'relation_id': None,
     }
     self.relation_set.assert_called_with(**ex)
 def test_keystone_joined_public_endpoint(self, _canonical_url):
     def fake_canonical_url(configs, endpoint_type):
         return {"public": "http://glance.example.com",
                 "int": "http://glancehost",
                 "admin": "http://glancehost"}[endpoint_type]
     _canonical_url.side_effect = fake_canonical_url
     self.test_config.set('os-public-hostname', 'glance.example.com')
     relations.keystone_joined()
     ex = {
         'region': 'RegionOne',
         'public_url': 'http://glance.example.com:9292',
         'admin_url': 'http://glancehost:9292',
         'service': 'glance',
         'internal_url': 'http://glancehost:9292',
         'relation_id': None,
     }
     self.relation_set.assert_called_with(**ex)
 def test_keystone_joined_partial_cluster(self):
     self.is_clustered.return_value = False
     self.test_config.set('vip', '10.0.0.10')
     relations.keystone_joined()
     self.assertFalse(self.relation_set.called)
 def test_keystone_joined_partial_cluster(self):
     self.is_clustered.return_value = False
     self.test_config.set('vip', '10.0.0.10')
     relations.keystone_joined()
     self.assertFalse(self.relation_set.called)
 def test_keystone_joined_not_leader(self):
     self.eligible_leader.return_value = False
     relations.keystone_joined()
     self.assertFalse(self.relation_set.called)