当前位置: 首页>>代码示例>>Python>>正文


Python browse_page.BrowsePage类代码示例

本文整理汇总了Python中v1.models.browse_page.BrowsePage的典型用法代码示例。如果您正苦于以下问题:Python BrowsePage类的具体用法?Python BrowsePage怎么用?Python BrowsePage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BrowsePage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_chart_block_inquiry_activity

        def test_chart_block_inquiry_activity(self):
            """ Management command correctly updates chart block dates for inquiry index charts"""
            browse_page = BrowsePage(
                title='Browse Page',
                slug='browse',
            )

            # Adds a Chart Block to a browse page
            browse_page.content = StreamValue(
                browse_page.content.stream_block,
                [atomic.chart_block_inquiry_activity],
                True
            )
            publish_page(child=browse_page)

            # Call management command to update values
            filename = os.path.join(
                settings.PROJECT_ROOT,
                'v1/tests/fixtures/data_snapshot.json'
            )
            call_command(
                'update_chart_block_dates',
                '--snapshot_file={}'.format(filename)
            )
            response = self.client.get('/browse/')

            # Tests last_updated_projected_data is correct
            self.assertContains(
                response,
                'The most recent data available in this visualization are for June 2018'
            )

            # Tests date_published is correct
            self.assertContains(response, 'October 2018')
开发者ID:cfpb,项目名称:cfgov-refresh,代码行数:34,代码来源:test_update_chart_block_dates.py

示例2: test_data_snapshot_with_optional_fields

    def test_data_snapshot_with_optional_fields(self):
        """ Data Snapshot with inquiry and tightness information correctly renders
        fields on a Browse Page"""
        browse_page = BrowsePage(
            title='Browse Page',
            slug='browse',
        )

        # Adds a AUT market to a browse page
        browse_page.content = StreamValue(
            browse_page.content.stream_block,
            [atomic.data_snapshot_with_optional_fields],
            True
        )
        publish_page(child=browse_page)

        response = self.client.get('/browse/')
        self.assertContains(response, '5 million')
        self.assertContains(response, '$64 billion')
        self.assertContains(response, '5% increase')
        self.assertContains(response, 'January 2015')
        self.assertContains(response, 'Loans originated')
        self.assertContains(response, 'Dollar value of new loans')
        self.assertContains(response, 'In year-over-year originations')
        # Should  include inquiry or tightness information
        self.assertContains(response, '7.4% decrease')
        self.assertContains(response, 'In year-over-year inquiries')
        self.assertContains(response, '2.8% increase')
        self.assertContains(response, 'In year-over-year credit tightness')
开发者ID:cfpb,项目名称:cfgov-refresh,代码行数:29,代码来源:test_organisms.py

示例3: test_data_snapshot

        def test_data_snapshot(self):
            """ Management command correctly updates data snapshot values"""
            browse_page = BrowsePage(
                title='Browse Page',
                slug='browse',
            )

            # Adds a AUT market to a browse page
            browse_page.content = StreamValue(
                browse_page.content.stream_block,
                [atomic.data_snapshot],
                True
            )
            publish_page(child=browse_page)

            # Call management command to update values
            filename = os.path.join(
                settings.PROJECT_ROOT,
                'v1/tests/fixtures/data_snapshots.json'
            )
            call_command(
                'update_data_snapshot_values',
                '--snapshot_file={}'.format(filename)
            )
            response = self.client.get('/browse/')
            self.assertContains(response, '2.1 million')
            self.assertContains(response, '$46.4 billion')
            self.assertContains(response, '5.8% increase')
            self.assertContains(response, 'March 2017')
            self.assertContains(response, 'Auto loans originated')
            self.assertContains(response, 'Dollar value of new loans')
            self.assertContains(response, 'In year-over-year originations')
开发者ID:OrlandoSoto,项目名称:cfgov-refresh,代码行数:32,代码来源:test_update_data_snapshot_values.py

示例4: test_expandable

 def test_expandable(self):
     """Expandable label value correctly displays on a Browse Page"""
     browse_page = BrowsePage(
         title='Browse Page',
         slug='browse',
     )
     browse_page.content = StreamValue(
         browse_page.content.stream_block,
         [atomic.expandable],
         True,
     )
     publish_page(child=browse_page)
     response = django_client.get('/browse/')
     self.assertContains(response, 'this is an expandable')
开发者ID:chosak,项目名称:cfgov-refresh,代码行数:14,代码来源:test_molecules.py

示例5: test_html_block

 def test_html_block(self):
     """ HTML Block correctly renders HTML on a Browse Page"""
     browse_page = BrowsePage(
         title='Browse Page',
         slug='browse',
     )
     browse_page.content = StreamValue(
         browse_page.content.stream_block,
         [atomic.html_block],
         True
     )
     publish_page(child=browse_page)
     response = self.client.get('/browse/')
     self.assertContains(response, 'Age 30 to 44')
开发者ID:amymok,项目名称:cfgov-refresh,代码行数:14,代码来源:test_organisms.py

示例6: test_expandable_group

 def test_expandable_group(self):
     """Expandable group correctly displays on a Browse Page"""
     browse_page = BrowsePage(
         title='Browse Page',
         slug='browse',
     )
     browse_page.content = StreamValue(
         browse_page.content.stream_block,
         [atomic.expandable_group],
         True
     )
     publish_page(child=browse_page)
     response = django_client.get('/browse/')
     self.assertContains(response, 'Expandable Group')
     self.assertContains(response, 'Expandable group body')
开发者ID:amymok,项目名称:cfgov-refresh,代码行数:15,代码来源:test_organisms.py

示例7: test_resource_list_set_col_width

    def test_resource_list_set_col_width(self):
        """ Resource List Assets column width is fixed when set"""
        assets_width_page = BrowsePage(
            title='Assets Width Test Page',
            slug='assets-width',
        )
        assets_width_page.content = StreamValue(
            assets_width_page.content.stream_block,
            [atomic.snippet_list_actions_column_width_40],
            True
        )
        publish_page(child=assets_width_page)

        self.create_resource()

        response = self.client.get('/assets-width/')
        self.assertContains(response, 'u-w40pct"')
开发者ID:cfpb,项目名称:cfgov-refresh,代码行数:17,代码来源:test_organisms.py

示例8: test_resource_list_show_thumbnails_true

    def test_resource_list_show_thumbnails_true(self):
        """ Resource List shows thumbnails when show_thumbnails is True"""
        thumbnails_page = BrowsePage(
            title='Thumbnails Page',
            slug='thumbnails',
        )
        thumbnails_page.content = StreamValue(
            thumbnails_page.content.stream_block,
            [atomic.snippet_list_show_thumbnails_true],
            True
        )
        publish_page(child=thumbnails_page)

        self.create_resource()

        response = self.client.get('/thumbnails/')
        self.assertContains(response, 'o-resource-list_list-thumbnail')
开发者ID:cfpb,项目名称:cfgov-refresh,代码行数:17,代码来源:test_organisms.py

示例9: test_resource_list_show_thumbnails_false

    def test_resource_list_show_thumbnails_false(self):
        """ Resource List doesn't show thumbs when show_thumbnails is False"""
        no_thumbnails_page = BrowsePage(
            title='No Thumbnails Page',
            slug='no-thumbnails',
        )
        no_thumbnails_page.content = StreamValue(
            no_thumbnails_page.content.stream_block,
            [atomic.snippet_list_show_thumbnails_false],
            True
        )
        publish_page(child=no_thumbnails_page)

        self.create_resource()

        response = self.client.get('/no-thumbnails/')
        self.assertNotContains(response, 'o-resource-list_list-thumbnail')
开发者ID:cfpb,项目名称:cfgov-refresh,代码行数:17,代码来源:test_organisms.py

示例10: test_featured_content

 def test_featured_content(self):
     """Featured content value correctly displays on a Browse Page"""
     bp = BrowsePage(
         title='Browse Page',
         slug='browse-page',
     )
     bp.header = StreamValue(bp.header.stream_block,
     [
         atomic.featured_content
     ], True)
     bp.content = StreamValue(bp.content.stream_block,
     [
         atomic.expandable,
         atomic.expandable_group
     ], True)
     publish_page(child=bp)
     response = django_client.get('/browse-page/')
     self.assertContains(response, 'this is a featured content body')
开发者ID:chosak,项目名称:cfgov-refresh,代码行数:18,代码来源:test_molecules.py

示例11: test_resource_list

    def test_resource_list(self):
        """ Resource List renders thumbnails when show_thumbnails is True"""
        browse_page = BrowsePage(
            title='Browse Page',
            slug='browse',
        )
        browse_page.content = StreamValue(
            browse_page.content.stream_block,
            [atomic.snippet_list_show_thumbnails_false],
            True
        )
        publish_page(child=browse_page)

        self.create_resource()

        response = self.client.get('/browse/')
        self.assertContains(response, 'Test Resource List')
        self.assertContains(response, 'Test Resource')
开发者ID:cfpb,项目名称:cfgov-refresh,代码行数:18,代码来源:test_organisms.py

示例12: test_data_snapshot_with_inquiry_and_tightness

        def test_data_snapshot_with_inquiry_and_tightness(self):
            """ Management command correctly updates data snapshot values
            for market that contains inquiry and tightness data"""
            browse_page = BrowsePage(
                title='Browse Page',
                slug='browse',
            )

            # Adds a AUT market to a browse page
            browse_page.content = StreamValue(
                browse_page.content.stream_block,
                [atomic.data_snapshot_with_optional_fields],
                True
            )
            publish_page(child=browse_page)

            # Call management command to update values
            filename = os.path.join(
                settings.PROJECT_ROOT,
                'v1/tests/fixtures/data_snapshot.json'
            )
            call_command(
                'update_data_snapshot_values',
                '--snapshot_file={}'.format(filename)
            )
            # July 2018 
            response = self.client.get('/browse/')
            self.assertContains(response, '2.5 million') # Auto loans originated
            self.assertContains(response, '$54.6 billion') # Dollar volume of new loans
            self.assertContains(response, '7.3% increase') # In year-over-year originations 
            self.assertContains(response, 'July 2018')
            self.assertContains(response, 'Loans originated')
            self.assertContains(response, 'Dollar value of new loans')
            self.assertContains(response, 'In year-over-year originations')
            # Inquiry and tightness values
            self.assertContains(response, '7.9% increase')
            self.assertContains(response, '2.8% increase')
            self.assertContains(response, 'In year-over-year inquiries')
            self.assertContains(
                response,
                'In year-over-year credit tightness'
            )
开发者ID:cfpb,项目名称:cfgov-refresh,代码行数:42,代码来源:test_update_data_snapshot_values.py

示例13: test_data_snapshot

        def test_data_snapshot(self):
            """ Management command correctly updates data snapshot values"""
            browse_page = BrowsePage(
                title='Browse Page',
                slug='browse',
            )

            # Adds a STU market to a browse page
            browse_page.content = StreamValue(
                browse_page.content.stream_block,
                [atomic.data_snapshot],
                True
            )
            publish_page(child=browse_page)

            # Call management command to update values
            filename = os.path.join(
                settings.PROJECT_ROOT,
                'v1/tests/fixtures/data_snapshot.json'
            )
            call_command(
                'update_data_snapshot_values',
                '--snapshot_file={}'.format(filename)
            )
            response = self.client.get('/browse/')

            # July 2018 data:
            self.assertContains(response, '917,007') # Student loans originated
            self.assertContains(response, '$16.6 billion') # Dollar volume of new loans
            self.assertContains(response, '48.0% increase') # In year-over-year originations
            self.assertContains(response, 'July 2018')
            self.assertContains(response, 'Loans originated')
            self.assertContains(response, 'Dollar value of new loans')
            self.assertContains(response, 'In year-over-year originations')
            # Should not contain inquiry and tightness values
            self.assertNotContains(response, 'In year-over-year inquiries')
            self.assertNotContains(
                response,
                'In year-over-year credit tightness'
            )
开发者ID:cfpb,项目名称:cfgov-refresh,代码行数:40,代码来源:test_update_data_snapshot_values.py

示例14: test_data_snapshot

    def test_data_snapshot(self):
        """ Data Snapshot correctly renders fields on a Browse Page"""
        browse_page = BrowsePage(
            title='Browse Page',
            slug='browse',
        )

        # Adds a AUT market to a browse page
        browse_page.content = StreamValue(
            browse_page.content.stream_block,
            [atomic.data_snapshot],
            True
        )
        publish_page(child=browse_page)

        response = self.client.get('/browse/')
        self.assertContains(response, '5 million')
        self.assertContains(response, '$64 billion')
        self.assertContains(response, '5% increase')
        self.assertContains(response, 'January 2015')
        self.assertContains(response, 'Auto loans originated')
        self.assertContains(response, 'Dollar value of new loans')
        self.assertContains(response, 'In year-over-year originations')
开发者ID:amymok,项目名称:cfgov-refresh,代码行数:23,代码来源:test_organisms.py

示例15: test_chart_block

    def test_chart_block(self):
        """ Chart Block correctly renders fields on a Browse Page"""
        browse_page = BrowsePage(
            title='Browse Page',
            slug='browse',
        )

        # Adds a AUT market to a browse page
        browse_page.content = StreamValue(
            browse_page.content.stream_block,
            [atomic.chart_block],
            True
        )
        publish_page(child=browse_page)

        response = self.client.get('/browse/')
        self.assertContains(response, 'Volume of credit cards originated')
        self.assertContains(response, 'foo/bar.csv')
        self.assertContains(response, 'Data not final')
        self.assertContains(
            response,
            'The most recent data available in each visualization is for April 2016'
        )
        self.assertContains(response, 'January 2018')
开发者ID:amymok,项目名称:cfgov-refresh,代码行数:24,代码来源:test_organisms.py


注:本文中的v1.models.browse_page.BrowsePage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。