File tree Expand file tree Collapse file tree 1 file changed +30
-10
lines changed Expand file tree Collapse file tree 1 file changed +30
-10
lines changed Original file line number Diff line number Diff line change
1
+ # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
1
2
"""
2
3
This file demonstrates two different styles of tests (one doctest and one
3
4
unittest). These will both pass when you run "manage.py test".
4
5
5
6
Replace these with more appropriate tests for your application.
6
7
"""
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
7
13
8
- from django .test import TestCase
14
+ class ProjectTest (unittest .TestCase ):
15
+ fixtures = [djity .__path__ [0 ]+ '/fixtures/test_project.json' ]
9
16
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 ):
12
23
"""
13
- Tests that 1 + 1 always equals 2.
24
+ Test the login
14
25
"""
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
+
16
41
17
- __test__ = {"doctest" : """
18
- Another way to test that 1 + 1 is equal to 2.
19
42
20
- >>> 1 + 1 == 2
21
- True
22
- """ }
23
43
You can’t perform that action at this time.
0 commit comments