diff options
author | Jelle van der Waa <jelle@vdwaa.nl> | 2018-03-25 17:34:03 +0200 |
---|---|---|
committer | Jelle van der Waa <jelle@vdwaa.nl> | 2018-03-25 17:34:44 +0200 |
commit | d8977b24f5eef6c1a231f56d48cf0e49e3337ec1 (patch) | |
tree | 79b0a3cef75badc08fe4a712f838389e43ee3596 /todolists | |
parent | ce0f2214a86d5f2490712d5881068d7770a80673 (diff) | |
download | archweb-d8977b24f5eef6c1a231f56d48cf0e49e3337ec1.tar.gz archweb-d8977b24f5eef6c1a231f56d48cf0e49e3337ec1.zip |
todolists: Add test for templatetags
Test a simple case of the todolist_details_link template tag
Diffstat (limited to 'todolists')
-rw-r--r-- | todolists/tests/test_templatetags_todolists.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/todolists/tests/test_templatetags_todolists.py b/todolists/tests/test_templatetags_todolists.py new file mode 100644 index 00000000..93cdbf94 --- /dev/null +++ b/todolists/tests/test_templatetags_todolists.py @@ -0,0 +1,29 @@ +from django.contrib.auth.models import User +from django.test import TestCase + + +from main.models import Package +from todolists.models import Todolist, TodolistPackage +from todolists.templatetags.todolists import todopkg_details_link + + +class TestTodolist(TestCase): + fixtures = ['main/fixtures/arches.json', 'main/fixtures/repos.json', + 'main/fixtures/package.json'] + + def setUp(self): + self.user = User.objects.create(username="joeuser", first_name="Joe", + last_name="User", email="user1@example.com") + self.todolist = Todolist.objects.create(name='Boost rebuild', + description='Boost 1.66 rebuid', + creator=self.user, + raw='linux') + + def test_details_link(self): + pkg = Package.objects.first() + todopkg = TodolistPackage.objects.create(pkg=pkg, pkgname=pkg.pkgname, + pkgbase=pkg.pkgbase, arch=pkg.arch, + repo=pkg.repo, user=self.user, + todolist=self.todolist) + link = todopkg_details_link(todopkg) + self.assertIn('View package details for {}'.format(todopkg.pkg.pkgname), link) |