def test_get(self, content, api_reader):
        content.return_value = ''
        api_reader.ApiReader.return_value.layer.return_value = {
            '204': [''],
        }
        request = RequestFactory().get(
            '/fake-path/204-2/2013-1?from_version=2014-2')

        view = ChromeSXSView.as_view(
            template_name='regulations/breakaway-chrome.html')
        response = view(
            request, label_id='204-2', from_version='2014-2',
            notice_id='2013-1')

        self.assertEqual(response.context_data['reg_part'], '204')
    def test_get(self, content, api_reader):
        content.return_value = ''
        api_reader.ApiReader.return_value.layer.return_value = {
            '204': [''],
        }
        request = RequestFactory().get(
            '/fake-path/204-2/2013-1?from_version=2014-2')

        view = ChromeSXSView.as_view(
            template_name='regulations/breakaway-chrome.html')
        response = view(request,
                        label_id='204-2',
                        from_version='2014-2',
                        notice_id='2013-1')

        self.assertEqual(response.context_data['reg_part'], '204')
Beispiel #3
0
     comment.SubmitCommentView.as_view(),
     name='comment_submit'),
 url(r'^comments/federal_agencies$', comment.get_federal_agencies),
 url(r'^comments/gov_agency_types$', comment.get_gov_agency_types),
 # Redirect to version by date (by GET)
 # Example http://.../regulation_redirect/201-3-v
 url(r'^regulation_redirect/%s$' % paragraph_pattern, redirect_by_date_get,
     name='redirect_by_date_get'),
 # Redirect to a diff based on GET params
 # Example http://.../diff_redirect/201-3/old_version?new_version=new
 url(r'^diff_redirect/%s/%s$' % (section_pattern, version_pattern),
     diff_redirect, name='diff_redirect'),
 # A section by section paragraph with chrome
 # Example: http://.../sxs/201-2-g/2011-1738
 url(r'^sxs/%s/%s$' % (paragraph_pattern, notice_pattern),
     lt_cache(ChromeSXSView.as_view()),
     name='chrome_sxs_view'),
 # Search results for non-JS viewers
 # Example: http://.../search?q=term&version=2011-1738
 url(r'^search(?:/cfr)?/%s$' % reg_pattern,
     ChromeSearchView.as_view(), name='chrome_search',
     kwargs={'doc_type': 'cfr'}),
 url(r'^search/preamble/%s$' % preamble_pattern,
     ChromePreambleSearchView.as_view(), name='chrome_search_preamble',
     kwargs={'doc_type': 'preamble'}),
 # Diff view of a section for non-JS viewers (or book markers)
 # Example: http://.../diff/201-4/2011-1738/2013-10704
 url(r'^diff/%s/%s/%s$' %
     (section_pattern, version_pattern, newer_version_pattern),
     lt_cache(ChromeSectionDiffView.as_view()),
     name='chrome_section_diff_view'),
Beispiel #4
0
 '',
 url(r'^$', universal, name='universal_landing'),
 # about page
 url(r'^about$', about, name='about'),
 # Redirect to version by date (by GET)
 # Example http://.../regulation_redirect/201-3-v
 url(r'^regulation_redirect/%s$' % paragraph_pattern, redirect_by_date_get,
     name='redirect_by_date_get'),
 # Redirect to a diff based on GET params
 # Example http://.../diff_redirect/201-3/old_version?new_version=new
 url(r'^diff_redirect/%s/%s$' % (section_pattern, version_pattern),
     diff_redirect, name='diff_redirect'),
 #A section by section paragraph with chrome
 #Example: http://.../sxs/201-2-g/2011-1738
 url(r'^sxs/%s/%s$' % (paragraph_pattern, notice_pattern),
     lt_cache(ChromeSXSView.as_view()),
     name='chrome_sxs_view'),
 # Search results for non-JS viewers
 # Example: http://.../search?q=term&version=2011-1738
 url(r'^search/%s$' % reg_pattern,
     ChromeSearchView.as_view(),
     name='chrome_search'),
 # Diff view of a section for non-JS viewers (or book markers)
 # Example: http://.../diff/201-4/2011-1738/2013-10704
 url(r'^diff/%s/%s/%s$' %
     (section_pattern, version_pattern, newer_version_pattern),
     lt_cache(ChromeSectionDiffView.as_view()),
     name='chrome_section_diff_view'),
 # Redirect to version by date
 # Example: http://.../201-3-v/1999/11/8
 url(r'^%s/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})$'
Beispiel #5
0

urlpatterns = patterns(
    "",
    url(r"^$", universal, name="universal_landing"),
    # about page
    url(r"^about$", about, name="about"),
    # Redirect to version by date (by GET)
    # Example http://.../regulation_redirect/201-3-v
    url(r"^regulation_redirect/%s$" % paragraph_pattern, redirect_by_date_get, name="redirect_by_date_get"),
    # Redirect to a diff based on GET params
    # Example http://.../diff_redirect/201-3/old_version?new_version=new
    url(r"^diff_redirect/%s/%s$" % (section_pattern, version_pattern), diff_redirect, name="diff_redirect"),
    # A section by section paragraph with chrome
    # Example: http://.../sxs/201-2-g/2011-1738
    url(r"^sxs/%s/%s$" % (paragraph_pattern, notice_pattern), ChromeSXSView.as_view(), name="chrome_sxs_view"),
    # Search results for non-JS viewers
    # Example: http://.../search?q=term&version=2011-1738
    url(r"^search/%s$" % reg_pattern, ChromeSearchView.as_view(), name="chrome_search"),
    # Diff view of a section for non-JS viewers (or book markers)
    # Example: http://.../diff/201-4/2011-1738/2013-10704
    url(
        r"^diff/%s/%s/%s$" % (section_pattern, version_pattern, newer_version_pattern),
        ChromeSectionDiffView.as_view(),
        name="chrome_section_diff_view",
    ),
    # Redirect to version by date
    # Example: http://.../regulations/201-3-v/1999/11/8
    url(
        r"^%s/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})$" % paragraph_pattern,
        redirect_by_date,
Beispiel #6
0
 # about page
 url(r'^about$', about, name='about'),
 # Redirect to version by date (by GET)
 # Example http://.../regulation_redirect/201-3-v
 url(r'^regulation_redirect/%s$' % paragraph_pattern,
     redirect_by_date_get,
     name='redirect_by_date_get'),
 # Redirect to a diff based on GET params
 # Example http://.../diff_redirect/201-3/old_version?new_version=new
 url(r'^diff_redirect/%s/%s$' % (section_pattern, version_pattern),
     diff_redirect,
     name='diff_redirect'),
 #A section by section paragraph with chrome
 #Example: http://.../sxs/201-2-g/2011-1738
 url(r'^sxs/%s/%s$' % (paragraph_pattern, notice_pattern),
     ChromeSXSView.as_view(),
     name='chrome_sxs_view'),
 # Search results for non-JS viewers
 # Example: http://.../search?q=term&version=2011-1738
 url(r'^search/%s$' % reg_pattern,
     ChromeSearchView.as_view(),
     name='chrome_search'),
 # Diff view of a section for non-JS viewers (or book markers)
 # Example: http://.../diff/201-4/2011-1738/2013-10704
 url(r'^diff/%s/%s/%s$' %
     (section_pattern, version_pattern, newer_version_pattern),
     ChromeSectionDiffView.as_view(),
     name='chrome_section_diff_view'),
 # Redirect to version by date
 # Example: http://.../regulations/201-3-v/1999/11/8
 url(r'^%s/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})$' %
Beispiel #7
0
 '',
 url(r'^$', universal, name='universal_landing'),
 # about page
 url(r'^about$', about, name='about'),
 # Redirect to version by date (by GET)
 # Example http://.../regulation_redirect/201-3-v
 url(r'^regulation_redirect/%s$' % paragraph_pattern, redirect_by_date_get,
     name='redirect_by_date_get'),
 # Redirect to a diff based on GET params
 # Example http://.../diff_redirect/201-3/old_version?new_version=new
 url(r'^diff_redirect/%s/%s$' % (section_pattern, version_pattern),
     diff_redirect, name='diff_redirect'),
 #A section by section paragraph with chrome
 #Example: http://.../sxs/201-2-g/2011-1738
 url(r'^sxs/%s/%s$' % (paragraph_pattern, notice_pattern),
     ChromeSXSView.as_view(),
     name='chrome_sxs_view'),
 # Search results for non-JS viewers
 # Example: http://.../search?q=term&version=2011-1738
 url(r'^search/%s$' % reg_pattern,
     ChromeSearchView.as_view(),
     name='chrome_search'),
 # Diff view of a section for non-JS viewers (or book markers)
 # Example: http://.../diff/201-4/2011-1738/2013-10704
 url(r'^diff/%s/%s/%s$' %
     (section_pattern, version_pattern, newer_version_pattern),
     ChromeSectionDiffView.as_view(),
     name='chrome_section_diff_view'),
 # Redirect to version by date
 # Example: http://.../regulations/201-3-v/1999/11/8
 url(r'^%s/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})$'