Changeset 6350
- Timestamp:
- Oct 28, 2008, 9:40:05 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/exodus/tests.py
r6340 r6350 1 1 import unittest 2 2 from django.test.client import Client 3 from django.db import connection 4 5 from exodus import settings 3 6 4 7 class AddTest(unittest.TestCase): … … 6 9 #Set up the client 7 10 self.client = Client() 11 12 #Set up the database 13 self.olddbname = settings.DATABASE_NAME 14 self.dbname = connection.creation.create_test_db() 15 16 def tearDown(self): 17 connection.creation.destroy_test_db(self.olddbname) 8 18 9 19 def test_addlocation(self): 10 # Issue a post. 11 response = self.client.post('/location/add/new/', \ 12 {'description': 'JohnLaan', 'Longitude': '34.55', \ 13 'Latitude' : '44.55', 'proceed': 'OK, proceed'}) 20 post_data = {'description': 'JohnLaan2', 'Longitude': '34.55', \ 21 'Latitude' : '44.55', 'pro/ceed': 'OK, proceed'} 22 response = self.client.post('/add/Location/new/', post_data) 14 23 15 # Check if response add location is 200.16 24 self.failUnlessEqual(response.status_code, 200) 17 25 18 26 def test_addnode(self): 19 # Issue a post. 20 response = self.client.post('/node/add/new/', \ 21 {'name' : 'Tabitha', 'location' : 1, \ 22 'status' : 'up', 'network' : 1, 'proceed': 'OK, proceed'}) 27 post_data = {'name' : 'Tabitha', 'location' : 1, \ 28 'status' : 'up', 'network' : 1, 'proceed': 'OK, proceed'} 23 29 24 # Check if response add location is 200. 30 response = self.client.post('/add/node/new/', post_data) 31 25 32 self.failUnlessEqual(response.status_code,200) 26 27 33 34 class wllogic(unittest.TestCase): 35 def test_new_SSID_name(self): 36 node = {} 37 node['name'] = 'testnode' 38 #XXX figure out node.name = 'testnode' and node.network.name='iets' 39 40 def test_parse_addr(self): 41 ip = '192.168.3.4' 42 from exodus.wllogic import parseaddr 43 parsed = parseaddr(ip) 44 from exodus.wllogic import showaddr 45 o_ip = showaddr(parsed) 46 self.failUnlessEqual(o_ip, ip) 47 28 48 def suite(): 29 return unittest.makeSuite(AddTest) 49 s = unittest.TestSuite() 50 s.addTest(unittest.makeSuite(AddTest)) 51 s.addTest(unittest.makeSuite(wllogic)) 52 53 return s
Note:
See TracChangeset
for help on using the changeset viewer.