예제 #1
0
 def test__scaffold_dm_handler_exception(self, os_remove_mock, *mocks):
     """Test _scaffold_dm_handler method exception raised result."""
     dm_handler = {}
     ctx = ContextMock()
     ctx.agent_config.decision_maker_handler = dm_handler
     with self.assertRaises(ClickException):
         _scaffold_dm_handler(ctx)
     os_remove_mock.assert_called_once()
예제 #2
0
 def test__scaffold_dm_handler_positive(self, *mocks):
     """Test _scaffold_dm_handler method for positive result."""
     dm_handler = {}
     ctx = ContextMock()
     ctx.agent_config.decision_maker_handler = dm_handler
     ctx.agent_loader.dump = mock.Mock()
     _scaffold_dm_handler(ctx)
     ctx.agent_loader.dump.assert_called_once()
예제 #3
0
 def test__scaffold_dm_handler_already_exists(self):
     """Test _scaffold_dm_handler method dm handler already exists result."""
     dm_handler = {"dm": "handler"}
     ctx = ContextMock()
     ctx.agent_config.decision_maker_handler = dm_handler
     with self.assertRaises(ClickException) as cm:
         _scaffold_dm_handler(ctx)
     self.assertEqual(
         "A decision maker handler specification already exists. Aborting...",
         str(cm.exception),
     )