Exemplo n.º 1
0
 def test_redirect_interp_appendix_invalid_date(self):
     request = self.factory.get(
         '/eregulations/1024-Appendices-Interp/2017-20417_20180101')
     response = redirect_eregs(request)
     self.assertEqual(
         response.get('location'),
         '/policy-compliance/rulemaking/regulations/1024/Interp-MS/')
Exemplo n.º 2
0
 def test_redirect_invalid_part_pattern(self):
     request = self.factory.get(
         '/eregulations/102/')
     response = redirect_eregs(request)
     self.assertEqual(
         response.get('location'),
         '/policy-compliance/rulemaking/regulations/')
 def test_redirect_search_invalid(self):
     request = self.factory.get('/eregulations/search/1002', )
     response = redirect_eregs(request)
     self.assertEqual(
         response.get('location'),
         '/policy-compliance/rulemaking/regulations/'
         'search-regulations/results/?regs=1002&q=')
Exemplo n.º 4
0
 def test_redirect_interp_intro(self):
     request = self.factory.get('/eregulations/1002-Interp-h1/2016-16301')
     response = redirect_eregs(request)
     self.assertEqual(
         response.get('location'),
         '/policy-compliance/rulemaking/regulations/1002/'
         '2016-07-11/h1-Interp/')
Exemplo n.º 5
0
 def test_interp_section_current(self):
     request = self.factory.get(
         '/eregulations/1002-Subpart-Interp/2017-20417_20180101')
     response = redirect_eregs(request)
     self.assertEqual(
         response.get('location'),
         '/policy-compliance/rulemaking/regulations/1002/Interp-1/')
Exemplo n.º 6
0
 def test_interp_section_current(self):
     request = self.factory.get(
         '/eregulations/1002-Subpart-Interp/2017-20417_20180101')
     response = redirect_eregs(request)
     self.assertEqual(
         response.get('location'),
         '/policy-compliance/rulemaking/regulations/1002/Interp-1/')
Exemplo n.º 7
0
 def test_redirect_interp_intro_bad_version(self):
     request = self.factory.get(
         '/eregulations/1030-Interp-h1/2011-31727')
     response = redirect_eregs(request)
     self.assertEqual(
         response.get('location'),
         '/policy-compliance/rulemaking/regulations/1030/Interp-0/')
Exemplo n.º 8
0
 def test_redirect_interp_appendix_invalid_date(self):
     request = self.factory.get(
         '/eregulations/1024-Appendices-Interp/2017-20417_20180101')
     response = redirect_eregs(request)
     self.assertEqual(
         response.get('location'),
         '/policy-compliance/rulemaking/regulations/1024/Interp-MS/')
Exemplo n.º 9
0
 def test_redirect_past_version(self):
     request = self.factory.get(
         '/eregulations/1002-1/2016-16301')
     response = redirect_eregs(request)
     self.assertEqual(
         response.get('location'),
         '/policy-compliance/rulemaking/regulations/1002/2016-07-11/1/')
Exemplo n.º 10
0
 def test_redirect_past_version_not_live(self):
     request = self.factory.get(
         '/eregulations/1002-1/2013-22752_20140110')
     response = redirect_eregs(request)
     self.assertEqual(
         response.get('location'),
         '/policy-compliance/rulemaking/regulations/1002/1/')
Exemplo n.º 11
0
 def test_redirect_interp_appendix(self):
     request = self.factory.get(
         '/eregulations/1002-Appendices-Interp/2016-16301')
     response = redirect_eregs(request)
     self.assertEqual(
         response.get('location'),
         '/policy-compliance/rulemaking/regulations/'
         '1002/2016-07-11/Interp-C/')
Exemplo n.º 12
0
 def test_redirect_no_pattern_match_after_part(self):
     """This tests our final fall-through redirect"""
     request = self.factory.get(
         '/eregulations/1002/9999/')
     response = redirect_eregs(request)
     self.assertEqual(
         response.get('location'),
         '/policy-compliance/rulemaking/regulations/1002/')
Exemplo n.º 13
0
 def test_redirect_interp_section_past(self):
     request = self.factory.get(
         '/eregulations/1002-Subpart-Interp/2016-16301')
     response = redirect_eregs(request)
     self.assertEqual(
         response.get('location'),
         '/policy-compliance/rulemaking/regulations/1002/'
         '2016-07-11/Interp-1/')
Exemplo n.º 14
0
 def test_redirect_interp_appendix(self):
     request = self.factory.get(
         '/eregulations/1002-Appendices-Interp/2016-16301')
     response = redirect_eregs(request)
     self.assertEqual(
         response.get('location'),
         '/policy-compliance/rulemaking/regulations/'
         '1002/2016-07-11/Interp-C/')
Exemplo n.º 15
0
 def test_interp_section_no_subpart_with_default_section(self):
     # another launch troublemaker
     request = self.factory.get('/eregulations/1005-Interp/2013-06861')
     response = redirect_eregs(request)
     self.assertEqual(
         response.get('location'),
         '/policy-compliance/rulemaking/regulations/1005/'
         '2013-03-26/Interp-2/')
Exemplo n.º 16
0
 def test_redirect_search(self):
     request = self.factory.get(
         '/eregulations/search/1002',
         {'q': 'california', 'version': '2011-1'})
     response = redirect_eregs(request)
     self.assertEqual(
         response.get('location'),
         '/policy-compliance/rulemaking/regulations/'
         'search-regulations/results/?regs=1002&q=california')
Exemplo n.º 17
0
 def test_redirect_interp_section_past_lowercase(self):
     # troublemaker URL on launch day
     request = self.factory.get(
         '/eregulations/1002-subpart-interp/2011-31714')
     response = redirect_eregs(request)
     self.assertEqual(
         response.get('location'),
         '/policy-compliance/rulemaking/regulations/1002/'
         '2011-12-30/Interp-1/')
Exemplo n.º 18
0
 def test_redirect_interp_section_past_lowercase(self):
     # troublemaker URL on launch day
     request = self.factory.get(
         '/eregulations/1002-subpart-interp/2011-31714')
     response = redirect_eregs(request)
     self.assertEqual(
         response.get('location'),
         '/policy-compliance/rulemaking/regulations/1002/'
         '2011-12-30/Interp-1/')
Exemplo n.º 19
0
 def test_interp_section_no_subpart_with_default_section(self):
     # another launch troublemaker
     request = self.factory.get(
         '/eregulations/1005-Interp/2013-06861')
     response = redirect_eregs(request)
     self.assertEqual(
         response.get('location'),
         '/policy-compliance/rulemaking/regulations/1005/'
         '2013-03-26/Interp-2/')
Exemplo n.º 20
0
 def test_redirect_reg_section_url(self):
     request = self.factory.get('/eregulations/1002-1/2017-20417_20180101')
     response = redirect_eregs(request)
     self.assertEqual(response.get('location'),
                      '/policy-compliance/rulemaking/regulations/1002/1/')
Exemplo n.º 21
0
 def test_redirect_reg_base_url(self):
     request = self.factory.get('/eregulations/1002')
     response = redirect_eregs(request)
     self.assertEqual(response.get('location'),
                      '/policy-compliance/rulemaking/regulations/1002/')
Exemplo n.º 22
0
 def test_redirect_reg_base_url(self):
     request = self.factory.get('/eregulations/1002')
     response = redirect_eregs(request)
     self.assertEqual(response.get('location'),
                      '/policy-compliance/rulemaking/regulations/1002/')
Exemplo n.º 23
0
 def test_redirect_reg_section_url(self):
     request = self.factory.get(
         '/eregulations/1002-1/2017-20417_20180101')
     response = redirect_eregs(request)
     self.assertEqual(response.get('location'),
                      '/policy-compliance/rulemaking/regulations/1002/1/')