--- /dev/null
+from django.test import TestCase
+
+import pyflakes.api
+import os
+
+class PyflakesTest(TestCase):
+ def setUp(self):
+ topdir = os.path.dirname(os.path.realpath(__file__))
+ self.pythonfiles = []
+
+ for folder, subfolders, files in os.walk(topdir):
+ if 'migrations' in subfolders:
+ subfolders.remove('migrations')
+
+ for file in files:
+ if not file.endswith('.py'):
+ continue
+ self.pythonfiles += [os.path.join(folder, file)]
+
+ def test_pyflakes(self):
+ for file in self.pythonfiles:
+ self.assertEqual(pyflakes.api.checkPath(file), 0)
a1 = Author.objects.create(name="JFK")
w1 = Work.objects.create(name="Berlin speech", author=a1)
q1 = Quote.objects.create(text="Ich bin...", work=w1)
+ self.q1 = q1
def test_one(self):
q = Quote.objects.filter(text__startswith="Ich")
self.assertEqual(q.count(), 1)
q = q[0]
+ self.assertEqual(q, self.q1)
self.assertEqual(q.work.author.name, "JFK")
class ViewsTest(TestCase):
from django.shortcuts import render
-from django.http import HttpResponse
-from django.template import loader
from random import randint