2014-12-04 04:36:17 +08:00
|
|
|
from django.test import SimpleTestCase
|
2018-03-25 04:38:20 +08:00
|
|
|
from django.utils.lorem_ipsum import WORDS
|
2014-11-12 09:32:44 +08:00
|
|
|
|
2014-12-07 16:43:10 +08:00
|
|
|
from ..utils import setup
|
2014-11-12 09:32:44 +08:00
|
|
|
|
|
|
|
|
2014-12-04 04:36:17 +08:00
|
|
|
class LoremTagTests(SimpleTestCase):
|
2014-11-12 09:32:44 +08:00
|
|
|
|
|
|
|
@setup({'lorem1': '{% lorem 3 w %}'})
|
|
|
|
def test_lorem1(self):
|
2014-12-07 16:43:10 +08:00
|
|
|
output = self.engine.render_to_string('lorem1')
|
2014-11-12 09:32:44 +08:00
|
|
|
self.assertEqual(output, 'lorem ipsum dolor')
|
2018-03-25 04:38:20 +08:00
|
|
|
|
|
|
|
@setup({'lorem_random': '{% lorem 3 w random %}'})
|
|
|
|
def test_lorem_random(self):
|
|
|
|
output = self.engine.render_to_string('lorem_random')
|
|
|
|
words = output.split(' ')
|
|
|
|
self.assertEqual(len(words), 3)
|
|
|
|
for word in words:
|
|
|
|
self.assertIn(word, WORDS)
|