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/')
Esempio 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=')
 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/')
 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/')
Esempio 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/')
Esempio 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/')
Esempio 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/')
Esempio 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/')
Esempio 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/')
Esempio 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/')
Esempio 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/')
Esempio 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/')
 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/')
 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/')
Esempio 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')
Esempio 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/')
 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/')
Esempio 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/')
 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/')
 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/')
Esempio 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/')
Esempio 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/')