Fix test_aodh_adapters unit tests

A recent change to charms.openstack causes a cluster adapter to be
created if it is missing which invokes a call to
reactive.RelationBase.from_state('cluster.connected') which fails
outside of a juju env. This unit test change passes a cluster
relation to the adapter class to stop one being automatically
created.

Closes-Bug: 1630358
Change-Id: Ifb23e39b9ee94620705688841fd11db641884f74
This commit is contained in:
Liam Young 2016-10-05 07:00:39 +00:00
parent 3f724963c2
commit 9e9ea827ec
1 changed files with 3 additions and 0 deletions

View File

@ -95,6 +95,8 @@ class TestAodhAdapters(Helper):
config.side_effect = lambda: reply
self.patch(aodh.charms_openstack.adapters.APIConfigurationAdapter,
'get_network_addresses')
cluster_relation = mock.MagicMock()
cluster_relation.relation_name = 'cluster'
amqp_relation = mock.MagicMock()
amqp_relation.relation_name = 'amqp'
shared_db_relation = mock.MagicMock()
@ -104,6 +106,7 @@ class TestAodhAdapters(Helper):
other_relation.thingy = 'help'
# verify that the class is created with a AodhConfigurationAdapter
b = aodh.AodhAdapters([amqp_relation,
cluster_relation,
shared_db_relation,
other_relation])
# ensure that the relevant things got put on.