File tree 2 files changed +17
-1
lines changed
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,22 @@ def setUp(self):
12
12
self .factory = RequestFactory ()
13
13
14
14
def test_own_track_log (self ):
15
+ o = {
16
+ 'tid' : 12 ,
17
+ 'lat' : 123.123 ,
18
+ 'lon' : 134.341
19
+ }
20
+ self .client .post ('/owntracks/logtracks' , json .dumps (o ), content_type = 'application/json' )
21
+ length = len (OwnTrackLog .objects .all ())
22
+ self .assertEqual (length , 1 )
23
+
24
+ o = {
25
+ 'tid' : 12 ,
26
+ 'lat' : 123.123
27
+ }
28
+ self .client .post ('/owntracks/logtracks' , json .dumps (o ), content_type = 'application/json' )
29
+ length = len (OwnTrackLog .objects .all ())
30
+ self .assertEqual (length , 1 )
15
31
user = BlogUser .objects .create_superuser (email = "liangliangyy1@gmail.com" ,
16
32
username = "liangliangyy1" , password = "liangliangyy1" )
17
33
Original file line number Diff line number Diff line change 15
15
@csrf_exempt
16
16
def manage_owntrack_log (request ):
17
17
try :
18
- s = json .loads (request .body )
18
+ s = json .loads (request .read (). decode ( 'utf-8' ) )
19
19
tid = s ['tid' ]
20
20
lat = s ['lat' ]
21
21
lon = s ['lon' ]
You can’t perform that action at this time.
0 commit comments