Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_init(self, mock_method):
crhelper.resource_helper.CfnResource()
mock_method.assert_called_once_with('DEBUG', boto_level='ERROR', formatter_cls=None)
crhelper.resource_helper.CfnResource(json_logging=True)
mock_method.assert_called_with('DEBUG', boto_level='ERROR', RequestType='ContainerInit')
def test_polling_init(self):
c = crhelper.resource_helper.CfnResource()
event = test_events['Create']
c._setup_polling = Mock()
c._remove_polling = Mock()
c._polling_init(event)
c._setup_polling.assert_called_once()
c._remove_polling.assert_not_called()
self.assertEqual(c.PhysicalResourceId, None)
c.Status = 'FAILED'
c._setup_polling.assert_called_once()
c._setup_polling.assert_called_once()
c = crhelper.resource_helper.CfnResource()
event = test_events['Create']
c._setup_polling = Mock()
c._remove_polling = Mock()
event['CrHelperPoll'] = "Some stuff"
c.PhysicalResourceId = None
c._polling_init(event)
c._remove_polling.assert_not_called()
c._setup_polling.assert_not_called()
c.Status = 'FAILED'
c._polling_init(event)
c._remove_polling.assert_called_once()
c._setup_polling.assert_not_called()
c.Status = ''
c.PhysicalResourceId = "some-id"