Skip to content

Commit ebac467

Browse files
committed
start test for djity
1 parent d67a2b2 commit ebac467

File tree

1 file changed

+30
-10
lines changed

1 file changed

+30
-10
lines changed

djity/project/tests.py

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,43 @@
1+
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
12
"""
23
This file demonstrates two different styles of tests (one doctest and one
34
unittest). These will both pass when you run "manage.py test".
45
56
Replace these with more appropriate tests for your application.
67
"""
8+
import json
9+
from django.utils import unittest
10+
from django.test.client import Client
11+
from djity.project.models import Project
12+
import djity
713

8-
from django.test import TestCase
14+
class ProjectTest(unittest.TestCase):
15+
fixtures = [djity.__path__[0]+'/fixtures/test_project.json']
916

10-
class SimpleTest(TestCase):
11-
def test_basic_addition(self):
17+
def setUp(self):
18+
# Every test needs a client.
19+
self.client = Client()
20+
21+
22+
def test_login(self):
1223
"""
13-
Tests that 1 + 1 always equals 2.
24+
Test the login
1425
"""
15-
self.failUnlessEqual(1 + 1, 2)
26+
argv = {
27+
'js_traget':'document',
28+
'path':'',
29+
'username':'admin',
30+
'password':'admin',
31+
'project_name':'root',
32+
'module_name':'home',
33+
'LANGUAGE_CODE':'fr'
34+
}
35+
Project.objects.get(name='root')
36+
response = self.client.post('/dajaxice/djity.portal.login/',{'callback':'Dajax.process','argv':json.dumps(argv)})
37+
self.assertEqual(response.status_code, 200)
38+
self.assertEqual(response.context['username'], 'admin')
39+
40+
1641

17-
__test__ = {"doctest": """
18-
Another way to test that 1 + 1 is equal to 2.
1942

20-
>>> 1 + 1 == 2
21-
True
22-
"""}
2343

0 commit comments

Comments
 (0)