Ejemplo n.º 1
0
 def test_regulation_exists(self, api_reader):
     api_reader.ApiReader.return_value.regversions.return_value = [{
         'version':
         'exists'
     }]
     reg_versions = reg_landing.regulation_exists('204')
     self.assertTrue(reg_versions)
Ejemplo n.º 2
0
    def fill_kwargs(self, kwargs):
        """Add the version and replace the label_id for the chrome context"""
        reg_part = kwargs['label_id']
        if not regulation_exists(reg_part):
            raise error_handling.MissingContentException()

        current, _ = get_versions(kwargs['label_id'])
        kwargs['version'] = current['version']
        kwargs['label_id'] = utils.first_section(reg_part, current['version'])
        return kwargs
Ejemplo n.º 3
0
    def fill_kwargs(self, kwargs):
        """Add the version and replace the label_id for the chrome context"""
        reg_part = kwargs['label_id']
        if not regulation_exists(reg_part):
            raise error_handling.MissingContentException()

        current, _ = get_versions(kwargs['label_id'])
        kwargs['version'] = current['version']
        kwargs['label_id'] = utils.first_section(reg_part, current['version'])
        return kwargs
Ejemplo n.º 4
0
    def get_context_data(self, **kwargs):
        """Add the version and replace the label_id for the chrome context"""

        reg_part = kwargs['label_id']
        if not regulation_exists(reg_part):
            raise error_handling.MissingContentException()

        current, _ = get_versions(kwargs['label_id'])
        kwargs['version'] = current['version']
        kwargs['label_id'] = utils.first_section(reg_part, current['version'])
        return super(ChromeLandingView, self).get_context_data(**kwargs)
Ejemplo n.º 5
0
    def get_context_data(self, **kwargs):
        """Add the version and replace the label_id for the chrome context"""

        reg_part = kwargs['label_id']
        if not regulation_exists(reg_part):
            raise error_handling.MissingContentException()

        current, _ = get_versions(kwargs['label_id'])
        kwargs['version'] = current['version']
        kwargs['label_id'] = utils.first_section(reg_part, current['version'])
        return super(ChromeLandingView, self).get_context_data(**kwargs)
Ejemplo n.º 6
0
 def test_regulation_exists_not(self, api_reader):
     api_reader.ApiReader.return_value.regversions.return_value = None
     reg_versions = reg_landing.regulation_exists('204')
     self.assertFalse(reg_versions)
Ejemplo n.º 7
0
 def test_regulation_exists_not(self, api_reader):
     api_reader.ApiReader.return_value.regversions.return_value = None
     reg_versions = reg_landing.regulation_exists('204')
     self.assertFalse(reg_versions)
Ejemplo n.º 8
0
 def test_regulation_exists(self, api_reader):
     api_reader.ApiReader.return_value.regversions.return_value = [{'version':'exists'}]
     reg_versions = reg_landing.regulation_exists('204')
     self.assertTrue(reg_versions)