def test_lambada_class(self):
"""Validate the base lambada class."""
tune = lambada.Lambada()
# Make sure we make the attributes we need
self.assertIsNotNone(getattr(tune, 'dancers'))
self.assertIsNotNone(getattr(tune, 'config'))
# Create a dancer and call it
tune.dancers['test'] = MagicMock()
context = LambdaContext('test')
tune('hi', context)
tune.dancers['test'].assert_called()
tune.dancers['test'].assert_called_with('hi', context)
# Try a dancer that doesn't exist
context = LambdaContext('nope')
with assertRaisesRegex(self, Exception, 'No matching dancer'):
tune('bye', context)
评论列表
文章目录