Esempio n. 1
0
    def setup_class(cls):
        PylonsTestCase.setup_class()
        HarvestFixture.setup_class()

        # prepare to render package page
        user = model.PSEUDO_USER__VISITOR
        c.pkg = model.Package.by_name(u'annakarenina')
        c.locale = 'en'
        c.body_class = 'hide-sidebar'
        c.controller = 'package'
        c.action = 'read'
        c.user = user
        c.is_preview = False
        c.hide_welcome_message = False
        context = {
            'model': model,
            'session': model.Session,
            'user': c.user,
            'package': c.pkg
        }
        c.pkg_dict = get_action('package_show')(context, {'id': c.pkg.id})

        # inject a mock-routes_dict into the environ in order
        # that the template can be rendered correctly.
        # See 'ckan/templates/layout_base.html'
        # (This is also fixed in ckan 1.5.1)
        import pylons
        pylons.request.environ.update({
            'pylons.routes_dict': {
                'action': 'test-action',
                'controller': 'test-package::',
            }
        })

        # Render package view page
        # (filter should not be called on this occasion)
        PackageSaver().render_package(c.pkg_dict, context)
        cls.pkg_page = render('package/read.html')

        # Expected URLs
        harvest_object_id = c.pkg.extras.get('harvest_object_id')
        cls.harvest_xml_url = '/api/2/rest/harvestobject/%s/xml' % harvest_object_id
        cls.harvest_html_url = '/api/2/rest/harvestobject/%s/html' % harvest_object_id
Esempio n. 2
0
    def setup_class(cls):
        PylonsTestCase.setup_class()
        HarvestFixture.setup_class()

        # prepare to render package page
        user = model.PSEUDO_USER__VISITOR
        c.pkg = model.Package.by_name(u'annakarenina')
        c.locale = 'en'
        c.body_class = 'hide-sidebar'
        c.controller = 'package'
        c.action = 'read'
        c.user = user
        c.is_preview = False
        c.hide_welcome_message = False
        context = {'model': model, 'session': model.Session,
                   'user': c.user,
                   'package':c.pkg}
        c.pkg_dict = get_action('package_show')(context, {'id':c.pkg.id})

        # inject a mock-routes_dict into the environ in order
        # that the template can be rendered correctly.
        # See 'ckan/templates/layout_base.html'
        # (This is also fixed in ckan 1.5.1)
        import pylons
        pylons.request.environ.update({'pylons.routes_dict': {
            'action': 'test-action',
            'controller': 'test-package::',
        }})

        # Render package view page
        # (filter should not be called on this occasion)
        PackageSaver().render_package(c.pkg_dict,
                                      context)
        cls.pkg_page = render('package/read.html')

        # Expected URLs
        harvest_object_id = c.pkg.extras.get('harvest_object_id')
        cls.harvest_xml_url = '/api/2/rest/harvestobject/%s/xml' % harvest_object_id
        cls.harvest_html_url = '/api/2/rest/harvestobject/%s/html' % harvest_object_id
Esempio n. 3
0
 def setup_class(cls):
     HarvestFixture.setup_class()
     cls.pkg_page = HTML(basic_package_page)
Esempio n. 4
0
 def setup_class(cls):
     HarvestFixture.setup_class()
     cls.pkg_page = HTML(basic_package_page)