|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import datetime
|
|
|
|
import random
|
|
|
|
import django.contrib.auth
|
|
|
|
from unittest import TestCase
|
|
|
|
from django.test import Client
|
|
|
|
from django.core.urlresolvers import reverse
|
|
|
|
from django.core.management import call_command
|
|
|
|
|
|
|
|
from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni
|
|
|
|
from seminar.testutils import create_test_data
|
|
|
|
|
|
|
|
class SeminarBasicTests(TestCase):
|
|
|
|
def setUp(self):
|
|
|
|
create_test_data(size=2)
|
|
|
|
self.client = Client()
|
|
|
|
|
|
|
|
def tearDown(self):
|
|
|
|
call_command('flush', noinput=True, verbosity=0, interactive=False)
|
|
|
|
self.cleint = None
|
|
|
|
|
|
|
|
def test_rocniky(self):
|
|
|
|
r19 = Rocnik.objects.get(rocnik=21)
|
|
|
|
self.assertEqual(r19.roman(), 'XXI')
|
|
|
|
|
|
|
|
def test_render_cislo_e2e(self):
|
|
|
|
cs = Cislo.objects.all()
|
|
|
|
for c in cs[:8]:
|
|
|
|
url = reverse('seminar.cislo', args=(c.id,))
|
|
|
|
r = self.client.get(url)
|
|
|
|
assert r.status_code == 200
|
|
|
|
assert len(r.content) >= 100
|
|
|
|
# TODO: Validate cntent as HTML
|
|
|
|
|
|
|
|
def test_render_problem_e2e(self):
|
|
|
|
ps = Problem.objects.all()
|
|
|
|
for p in ps[:10]:
|
|
|
|
url = reverse('seminar.problem', args=(p.id,))
|
|
|
|
r = self.client.get(url)
|
|
|
|
assert r.status_code == 200
|
|
|
|
assert len(r.content) >= 100
|
|
|
|
# TODO: Validate cntent as HTML
|
|
|
|
|
|
|
|
|