def test_get_sentry_relations_not_found(self): d = Deployment(juju_env='gogo') d.relations = [] with self.assertRaises(LookupError) as e: d._get_sentry_relations('charm:db', 'mysql:db') self.assertEqual( str(e), 'Could not find relation between charm:db and mysql:db') d.cleanup()
def test_get_sentry_relations(self): d = Deployment(juju_env='gogo') d.relations = [ ['relation-sentry:provides-mysql_db-charm_db', 'mysql:db'], ['relation-sentry:requires-mysql_db-charm_db', 'charm:db'], ] self.assertEqual( d._get_sentry_relations('charm:db', 'mysql:db'), d.relations) self.assertEqual( d._get_sentry_relations('mysql:db', 'charm:db'), list(reversed(d.relations))) d.cleanup()