products/CPSRSS

changeset 240:09638c25ff91

Updated the tests view
author Georges Racinet on purity.racinet.fr <georges@racinet.fr>
date Mon, 06 Dec 2010 01:48:22 +0100
parents 4e3bc0f69fed
children 4a1f6e273c39
files tests/test_views.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/tests/test_views.py
     1.2 +++ b/tests/test_views.py
     1.3 @@ -54,6 +54,13 @@
     1.4          view = self.makeView()
     1.5          self.assertTrue(view.hasContainer())
     1.6  
     1.7 +    @staticmethod
     1.8 +    def extractChannels(view):
     1.9 +        # call the view API and present channels as dicts for easy assert
    1.10 +        # why staticmethod ? for fun
    1.11 +        return tuple(dict(id=chan.getId(), title=chan.title)
    1.12 +                     for chan in view.channels())
    1.13 +
    1.14      def test_channels(self):
    1.15          view = self.makeView()
    1.16          self.assertEquals(view.channels(), ())
    1.17 @@ -63,7 +70,7 @@
    1.18          view.addChannel(url=get_feed_url('zope.rss'))
    1.19          view.addChannel(url=get_feed_url('trac_cps.rss'))
    1.20  
    1.21 -        self.assertEquals(view.channels(),
    1.22 +        self.assertEquals(self.extractChannels(view),
    1.23                            (dict(id='zope-org', title='Zope.org'),
    1.24                             dict(id='cps-cms-ticket-query',
    1.25                                  title='CPS CMS: Ticket Query')))
    1.26 @@ -75,7 +82,7 @@
    1.27          view.request.form['channel_url'] = get_feed_url('zope.rss')
    1.28          view.addChannel()
    1.29  
    1.30 -        self.assertEquals(view.channels(),
    1.31 +        self.assertEquals(self.extractChannels(view),
    1.32                            (dict(id='zope-org', title='Zope.org'),))
    1.33  
    1.34