Commit 60bc49ab authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Merge branch 'test_merchandise' into 'master'

Test the merchandise package

See merge request !1190
parents c0062b4c f04e458c
[{"model": "merchandise.merchandiseitem", "pk": 1, "fields": {"price": "901.00", "image": "hoedje.png", "name_en": "Fancy hat", "name_nl": "Kek hoedje", "description_en": "Extremely fancy hat", "description_nl": "Extreem kek hoedje"}}, {"model": "merchandise.merchandiseitem", "pk": 2, "fields": {"price": "9.00", "image": "badjas.png", "name_en": "bathrobe", "name_nl": "badjas", "description_en": "Limited edition bathrobe", "description_nl": "limited edition badjas"}}]
\ No newline at end of file
from django import test
from django.utils import translation
from . import sitemaps
class SitemapTests(test.SimpleTestCase):
"""Tests the sitemaps"""
def test_staticviewsitemap(self):
"""Tests the ``:class::merchandise.sitemaps.StaticViewSitemap``"""
sitemap = sitemaps.StaticViewSitemap()
items = sitemap.items()
self.assertNotEqual(items, [])
for item in items:
self.assertNotEqual(sitemap.location(item), '')
class ViewTests(test.TestCase):
"""Tests the views of this method"""
fixtures = ['merchandiseitems.json']
def test_index_en(self):
"""Tests the english index page lists the merchandise items"""
with translation.override('en'):
response = self.client.get('/merchandise/')
self.assertContains(response, 'fancy hat')
self.assertContains(response, '901.00')
self.assertContains(response, 'bathrobe')
self.assertContains(response, '9.00')
def test_index_nl(self):
"""Tests the english index page lists the merchandise items"""
response = self.client.get('/merchandise/', HTTP_ACCEPT_LANGUAGE='nl')
self.assertContains(response, 'Kek hoedje')
self.assertContains(response, '901,00')
self.assertContains(response, 'badjas')
self.assertContains(response, '9,00')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment