~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:57:30 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-20090704085730-o7n81o5ddx2qnw5g
Test deep view generation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
299
299
        self.rtr.add_reverse(Subject, subject_url)
300
300
        self.rtr.add_reverse(Offering, offering_url)
301
301
        self.rtr.add_reverse(OfferingFiles, offering_files_url)
 
302
        self.rtr.add_reverse(Project, project_url)
302
303
        self.rtr.add_view(Subject, '+index', SubjectIndex, viewset='browser')
303
304
        self.rtr.add_view(Subject, '+edit', SubjectEdit, viewset='browser')
304
305
        self.rtr.add_view(Offering, '+index', OfferingIndex, viewset='browser')
305
306
        self.rtr.add_view(Offering, '+index', OfferingAPIIndex, viewset='api')
 
307
        self.rtr.add_view(Project, '+index', ProjectIndex, viewset='browser')
 
308
        self.rtr.add_view(Offering, ('+projects', '+new'), OfferingAddProject,
 
309
                          viewset='browser')
306
310
 
307
311
    def testOneLevel(self):
308
312
        assert_equal(self.rtr.generate(self.r.subjects['info1']), '/info1')
356
360
            '/api/info1/2009/1'
357
361
            )
358
362
 
 
363
    def testDeepView(self):
 
364
        assert_equal(
 
365
            self.rtr.generate(
 
366
                self.r.subjects['info1'].offerings[(2009, 1)],
 
367
                OfferingAddProject
 
368
                ),
 
369
        '/info1/2009/1/+projects/+new'
 
370
        )
 
371
 
 
372
    def testNamedRouteWithDeepView(self):
 
373
        assert_equal(
 
374
            self.rtr.generate(
 
375
                self.r.subjects['info1'].offerings[(2009, 1)].projects['p1'],
 
376
                ProjectIndex
 
377
                ),
 
378
        '/info1/2009/1/+projects/p1'
 
379
        )
 
380
 
 
381
 
359
382
 
360
383
class TestErrors(BaseTest):
361
384
    def setUp(self):