def setUp(self):
        model_run = ModelRun()
        model_run.name = "Model Run"
        model_run.user_id = 10

        output_var = OutputVariable()
        output_var.name = "gpp_gb"
        output_var.description = "Gridbox gross primary productivity"

        model_run_service = MagicMock()
        model_run_service.get_model_by_id = MagicMock(return_value=model_run)
        model_run_service.get_output_variable_by_id = MagicMock(return_value=output_var)

        self.download_helper = NetcdfDatasetDownloadHelper(model_run_service)
        self.user = User()
        self.user.name = 'User Name'
        self.user.id = 10
    def parse(self, file_path):
        """
        Run the parser on the output variables file and return a list of OutputVariables
        :param file_path: path of output-variables.html
        :return: list of OutputVariables
        """
        log.info("Parsing %s" % file_path)
        tree = html.parse(file_path)
        output_variables = []
        output_table_rows = tree.xpath(
            '//div[@id="variables-that-have-a-single-value-at-each-land-gridpoint"]/table/tbody/tr[@class="row-even"] '
            '| //div[@id="variables-that-have-a-single-value-at-each-land-gridpoint"]/table/tbody/tr[@class="row-odd"]'
            '| //div[@id="variables-that-have-a-single-value-at-each-gridpoint-land-and-sea"]/table/tbody/tr[@class="row-even"] '
            '| //div[@id="variables-that-have-a-single-value-at-each-gridpoint-land-and-sea"]/table/tbody/tr[@class="row-odd"]')

        for output_row in output_table_rows:
            output_variable = OutputVariable()
            name = str(output_row.xpath('td/tt/span[@class="pre"]/text()')[0])
            if name.lower() in self._VARIABLES_THAT_SHOULD_BE_USED:
                output_variable.name = name
                # Need to reconstruct the description because of <sup> tags
                desc_texts = output_row.xpath('td[2]/text() | td[2]/p[1]/text()')
                desc_tags = output_row.xpath('td[2]/sup/text() | td[2]/p[1]/sup/text() | td[2]/tt/span/text() '
                                             '| td[2]/a/tt/span/text()')
                output_variable.description = unicode(desc_texts[0])
                for i in range(len(desc_tags)):
                    output_variable.description += desc_tags[i]
                    output_variable.description += desc_texts[i+1]
                output_variable.depends_on_nsmax = output_variable.name in constants.DEPENDS_ON_NSMAX
                output_variables.append(output_variable)

        if (len(output_variables) != len(self._VARIABLES_THAT_SHOULD_BE_USED)):
            log.error("'Output variables' length, %s, if different to 'variables to use' length, %s "
                      % (len(output_variables), len(self._VARIABLES_THAT_SHOULD_BE_USED)))
            exit(-1)
        return output_variables