~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/urls/test_router.py

  • Committer: William Grant
  • Date: 2009-07-04 08:15:15 UTC
  • mto: (1294.4.2 ui-the-third)
  • mto: This revision was merged to the branch mainline in revision 1353.
  • Revision ID: grantw@unimelb.edu.au-20090704081515-g748w4o7353j97v8
Test generation of URLs for named routes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
def offering_url(offering):
84
84
    return (offering.subject, (str(offering.year), str(offering.semester)))
85
85
 
86
 
def offering_projects_url(offeringprojects):
87
 
    return (offeringprojects.offering, '+projects')
 
86
def offering_files_url(offeringfiles):
 
87
    return (offeringfiles.offering, '+files')
88
88
 
89
89
 
90
90
class BaseTest(object):
250
250
        self.rtr.add_set_switch('api', 'api')
251
251
        self.rtr.add_reverse(Subject, subject_url)
252
252
        self.rtr.add_reverse(Offering, offering_url)
 
253
        self.rtr.add_reverse(OfferingFiles, offering_files_url)
253
254
        self.rtr.add_view(Subject, '+index', SubjectIndex, viewset='browser')
254
255
        self.rtr.add_view(Subject, '+edit', SubjectEdit, viewset='browser')
255
256
        self.rtr.add_view(Offering, '+index', OfferingIndex, viewset='browser')
268
269
            '/info2/2008/2'
269
270
            )
270
271
 
 
272
    def testNamedRoute(self):
 
273
        assert_equal(self.rtr.generate(
 
274
                OfferingFiles(self.r.subjects['info1'].offerings[(2009, 1)])),
 
275
                '/info1/2009/1/+files'
 
276
            )
 
277
 
271
278
    def testView(self):
272
279
        assert_equal(self.rtr.generate(self.r.subjects['info1'], SubjectEdit),
273
280
                     '/info1/+edit'