+ self.n2vc.libjuju.get_metrics.assert_called_once()
+
+
+class UpdateVcaStatusTest(N2VCJujuConnTestCase):
+ def setUp(self):
+ super(UpdateVcaStatusTest, self).setUp()
+ self.n2vc.libjuju.get_controller = AsyncMock()
+ self.n2vc.libjuju.get_model = AsyncMock()
+ self.n2vc.libjuju.get_executed_actions = AsyncMock()
+ self.n2vc.libjuju.get_actions = AsyncMock()
+ self.n2vc.libjuju.get_application_configs = AsyncMock()
+ self.n2vc.libjuju._get_application = AsyncMock()
+
+ def test_success(
+ self,
+ ):
+ self.loop.run_until_complete(
+ self.n2vc.update_vca_status(
+ {"model": {"applications": {"app": {"actions": {}}}}}
+ )
+ )
+ self.n2vc.libjuju.get_executed_actions.assert_called_once()
+ self.n2vc.libjuju.get_actions.assert_called_once()
+ self.n2vc.libjuju.get_application_configs.assert_called_once()
+
+ def test_exception(self):
+ self.n2vc.libjuju.get_model.return_value = None
+ self.n2vc.libjuju.get_executed_actions.side_effect = Exception()
+ with self.assertRaises(Exception):
+ self.loop.run_until_complete(
+ self.n2vc.update_vca_status(
+ {"model": {"applications": {"app": {"actions": {}}}}}
+ )
+ )
+ self.n2vc.libjuju.get_executed_actions.assert_not_called()
+ self.n2vc.libjuju.get_actions.assert_not_called_once()
+ self.n2vc.libjuju.get_application_configs.assert_not_called_once()