- Timestamp:
- Jan 15, 2009, 8:53:37 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/exodus/tests.py
r6475 r6605 1 1 import unittest 2 2 3 class AddTest(unittest.TestCase):3 class ExodusTestCase(unittest.TestCase): 4 4 def setUp(self): 5 #Set up the client6 5 from django.test.client import Client 7 self.client = Client() 8 9 #Set up a inmemory database 6 self.client = Client() 10 7 from exodus import settings 11 8 self.olddbname = settings.DATABASE_NAME 12 9 from django.db import connection 13 10 self.dbname = connection.creation.create_test_db(0) 14 11 12 #create four locations 15 13 from exodus.models import Location 16 17 self.location = Location(description = 'Hooigracht', \ 18 longitude = '45.675433', latitude = '56.543332') 19 self.location.save() 14 loc1 = Location.objects.create(description = 'ASW', 15 latitude = '15.12345', 16 longitude = '16.12345') 17 loc2 = Location.objects.create(description = 'Rapenburg', 18 latitude = '27.12345', 19 longitude = '28.12345') 20 loc3 = Location.objects.create(description = 'Lepelenburg', 21 latitude = '37.12345', 22 longitude = '48.12345') 23 loc4 = Location.objects.create(description = 'Neude', 24 latitude = '57.12345', 25 longitude = '58.12345') 26 import pdb; pdb.set_trace() ; 20 27 21 28 def tearDown(self): … … 23 30 connection.creation.destroy_test_db(self.olddbname, 0) 24 31 25 26 class IPCalcTest(unittest.TestCase): 27 def setUp(self): 28 #Set up the client 29 from django.test.client import Client 30 self.client = Client() 31 32 #Set up a inmemory database 33 from exodus import settings 34 self.olddbname = settings.DATABASE_NAME 35 from django.db import connection 36 self.dbname = connection.creation.create_test_db(0) 37 32 class LocationTest(ExodusTestCase): 33 pass 34 35 36 class IPCalcTest(ExodusTestCase): 37 38 def ipcalc(a): 38 39 from exodus.models import Node 39 self.node = Node.objects.get(pk=1) 40 40 node = Node.objects.get(pk=1) 41 41 from exodus.wlipcalc import IPCalc 42 self.ipcalc = lambda a: IPCalc(self.node, a) 43 self.IPCalc = IPCalc 42 return IPCalc(node, a) 44 43 45 44 def test_ipcalc_ip_size(self): … … 108 107 self.failUnlessEqual(ipcalc.ips, ip_list) 109 108 110 def tearDown(self): 111 from django.db import connection 112 connection.creation.destroy_test_db(self.olddbname, 0) 113 114 115 116 class wllogic(unittest.TestCase): 117 def setUp(self): 118 #Set up the client 119 from django.test.client import Client 120 self.client = Client() 121 122 #Set up the database 123 from django.db import connection 124 from exodus import settings 125 self.olddbname = settings.DATABASE_NAME 126 self.dbname = connection.creation.create_test_db(0) 127 128 def tearDown(self): 129 from django.db import connection 130 connection.creation.destroy_test_db(self.olddbname, 0) 109 class wllogic(ExodusTestCase): 131 110 132 111 def test_new_ssid(self): … … 303 282 def suite(): 304 283 s = unittest.TestSuite() 305 s.addTest(unittest.makeSuite(AddTest))306 284 s.addTest(unittest.makeSuite(wllogic)) 307 285 s.addTest(unittest.makeSuite(IPCalcTest))
Note:
See TracChangeset
for help on using the changeset viewer.