I've created test.py module, filled with
from django.test import TestCase
from django.test.client import Client
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from forum.models import *
class SimpleTest(TestCase):
def setUp(self):
u = User.objects.create_user("ak", "[email protected]", "pwd")
Forum.objects.create(title="forum")
Site.objects.create(domain="test.org", name="test.org")
def content_test(self, url, values):
"""Get content of url and test that each of items in `values` list is present."""
r = self.c.get(url)
self.assertEquals(r.status_code, 200)
for v in values:
self.assertTrue(v in r.content)
def test(self):
self.c = Client()
self.c.login(username="ak", password="pwd")
self.content_test("/forum/", ['<a href="/forum/forum/1/">forum</a>'])
....
and placed it in folder with my application. When i run tests by
python manage.py test forum
after creating the test database i get an answer "Ran 0 tests in 0.000s"
What am i doing wrong ?
P.S. Here is my project hierarchy:
MyProj:
forum (it's my app):
manage.py
models.py
views.py
tests.py
...
I renamed test.py to tests.py. Eclipse got that this module is with tests, but answer is still "Ran 0 tests in 0.000s"