2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 12:35:46 +00:00
Files
InvenTree/InvenTree/plugin/test_helpers.py
Matthias Mair abf133384b Optimisations for editable installs of plugins (#3634)
* out-of-scope: add function to check if a package is editable

* out-of-scope: move to included meta toolset for metadata discovery

* out-of-scope: make lookup safe for editable installs
2022-09-05 13:03:26 +10:00

24 lines
748 B
Python

"""Unit tests for helpers.py."""
from django.test import TestCase
from .helpers import render_template
class HelperTests(TestCase):
"""Tests for helpers."""
def test_render_template(self):
"""Check if render_template helper works."""
class ErrorSource:
slug = 'sampleplg'
# working sample
response = render_template(ErrorSource(), 'sample/sample.html', {'abc': 123})
self.assertEqual(response, '<h1>123</h1>\n')
# Wrong sample
response = render_template(ErrorSource(), 'sample/wrongsample.html', {'abc': 123})
self.assertTrue('lert alert-block alert-danger' in response)
self.assertTrue('Template file <em>sample/wrongsample.html</em>' in response)