Changeset 6641


Ignore:
Timestamp:
Jan 25, 2009, 11:53:59 PM (16 years ago)
Author:
roland
Message:

First work on unittests for forms.py
-Finished tests for LocationForm.

Location:
trunk/exodus/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/exodus/tests/base.py

    r6637 r6641  
    1919        loc3 = Location.objects.create(description = 'Lepelenburg',
    2020                latitude = '37.12345', longitude = '48.12345')
    21         loc4 = Location.objects.create(description = 'Neude',
    22                 latitude = '57.12345', longitude = '58.12345')
    2321
    2422        # We assume the wleiden.net network is already created via initial_data.
  • trunk/exodus/tests/test_forms.py

    r6608 r6641  
    33from exodus.tests.base import BootstrapTestCase
    44
    5 class FormsTest(BootstrapTestCase):
     5class LocationFormTest(BootstrapTestCase):
     6   
     7    def test_location_form(self):
     8        from exodus.forms import LocationForm
     9        data = { 'description': 'Locatie Descriptie',
     10            'latitude':12.34567, 'longitude':13.45676}
     11        form = LocationForm(data)
     12        self.assertTrue(form.is_valid())
     13        form.save()
     14        from exodus.models import Location
     15        loc = Location.objects.get(description='Locatie Descriptie')
     16        self.assertEquals(loc.pk, 4)
     17        import decimal as D
     18        self.assertEquals(loc.latitude, D.Decimal("12.34567"))
     19        self.assertEquals(loc.longitude, D.Decimal("13.45676"))
     20
     21class NodeFormTest(BootstrapTestCase):
     22    pass
     23
     24class InterfaceFormTest(BootstrapTestCase):
     25    pass
     26
     27class DhcpStaticFormTest(BootstrapTestCase):
    628    pass
    729
    830def suite():
    931    s = unittest.TestSuite()
    10     s.addTest(unittest.makeSuite(FormsTest))
     32    s.addTest(unittest.makeSuite(LocationFormTest))
     33    s.addTest(unittest.makeSuite(NodeFormTest))
     34    s.addTest(unittest.makeSuite(InterfaceFormTest))
     35    s.addTest(unittest.makeSuite(DhcpStaticFormTest))
    1136    return s
Note: See TracChangeset for help on using the changeset viewer.