+ def test_cmr_relation_different_controller(self):
+ self.n2vc._get_libjuju = AsyncMock(return_value=self.n2vc.libjuju)
+ relation_endpoint_1 = RelationEndpoint(
+ "model-1.app1.0", "vca-id-1", "endpoint1"
+ )
+ relation_endpoint_2 = RelationEndpoint(
+ "model-1.app2.1", "vca-id-2", "endpoint2"
+ )
+ offer = Offer("admin/model-1.app1")
+ self.n2vc.libjuju.offer.return_value = offer
+ self.n2vc.libjuju.consume.return_value = "saas"
+ self.loop.run_until_complete(
+ self.n2vc.add_relation(relation_endpoint_1, relation_endpoint_2)
+ )
+ self.n2vc.libjuju.offer.assert_called_once_with(relation_endpoint_1)
+ self.n2vc.libjuju.consume.assert_called_once()
+ self.n2vc.libjuju.add_relation.assert_called_once_with(
+ "model-1", "app2:endpoint2", "saas"
+ )
+