-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_server.py
More file actions
33 lines (23 loc) · 814 Bytes
/
test_server.py
File metadata and controls
33 lines (23 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import json
import server
import unittest
# This lets us connect to the db
import pymongo
from pymongo import Connection
# get a connection to mongod which must be running
connection = Connection()
# get a handle on our database
db = connection.radar
class Test(unittest.TestCase):
def setUp(self):
collection = db.testTraps
collection.insert(json.load(open('test/test_traps.json'))['traps'])
collection.ensure_index( [( "loc" , "2d" )] )
def _tearDown(self):
collection = db.testTraps
collection.remove()
def test_gettraps(self):
collection = db.testTraps
server.gettraps({"loc": [33.5905, -117.2404], "speed": 20, "bearing": 304.58087947835827, "id": "1asasd23"}, collection=collection)
if __name__ == '__main__':
unittest.main()