aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-08-07 19:50:34 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-08-07 19:50:34 +1200
commitc3d2ad1caf639ae648421d66f6c627e97e81579b (patch)
treefa45fbf6988646974580a1327fd85ca6ff017fd5 /tools
parent20f627361ca717ef7c4d74b491cf50efecab4467 (diff)
downloadtraccar-server-c3d2ad1caf639ae648421d66f6c627e97e81579b.tar.gz
traccar-server-c3d2ad1caf639ae648421d66f6c627e97e81579b.tar.bz2
traccar-server-c3d2ad1caf639ae648421d66f6c627e97e81579b.zip
Add debugging to test script
Diffstat (limited to 'tools')
-rwxr-xr-xtools/test-integration.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/test-integration.py b/tools/test-integration.py
index be3f24a4d..64abc9ffe 100755
--- a/tools/test-integration.py
+++ b/tools/test-integration.py
@@ -1,5 +1,6 @@
#!/usr/bin/python
+import sys
import os
import xml.etree.ElementTree
import urllib
@@ -46,6 +47,8 @@ messages = {
baseUrl = 'http://localhost:8082'
user = { 'email' : 'admin', 'password' : 'admin' }
+debug = '-v' in sys.argv
+
def load_ports():
ports = {}
dir = os.path.dirname(os.path.abspath(__file__))
@@ -54,11 +57,15 @@ def load_ports():
key = entry.attrib['key']
if key.endswith('.port'):
ports[key[:-5]] = int(entry.text)
+ if debug:
+ print '\nports: %s\n' % repr(ports)
return ports
def login():
request = urllib2.Request(baseUrl + '/api/login')
response = urllib2.urlopen(request, urllib.urlencode(user))
+ if debug:
+ print '\nlogin: %s\n' % repr(json.load(response))
return response.headers.get('Set-Cookie')
def remove_devices(cookie):
@@ -66,10 +73,14 @@ def remove_devices(cookie):
request.add_header('cookie', cookie)
response = urllib2.urlopen(request)
data = json.load(response)
+ if debug:
+ print '\ndevices: %s\n' % repr(ports)
for device in data['data']:
request = urllib2.Request(baseUrl + '/api/device/remove')
request.add_header('cookie', cookie)
response = urllib2.urlopen(request, json.dumps(device))
+ if debug:
+ print '\nremove: %s\n' % repr(json.load(response))
def add_device(cookie, unique_id):
request = urllib2.Request(baseUrl + '/api/device/add')