當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。