def test_render(mocked_settings): ''' Test if a message template is rendered with a specified context. ''' with tempfile.TemporaryDirectory() as tempdir: path = os.path.join(tempdir, 'templates') os.mkdir(path) template_path = os.path.join(path, 'template.md') with open(template_path, 'w') as template: template.write('{{ user }} {{ text }}!') mocked_settings.TEMPLATES = [path] rendered = render(message, 'template.md', {'text': 'rocks'}) assert rendered == 'Bottery rocks!'
def greetings(message): return render(message, 'hello.md')
def hello(message): return render(message, 'hello.md')
async def start(message): return render(message, "start.md")