Ejemplo n.º 1
0
    def test_process(self, ext):
        """ Reporter.load().process() test """

        report = Reporter.load(ext, 'test.local', self.mockdata)
        self.assertIsNone(report.process())
        if ext in ['html','json']:
            self.assertTrue(filesystem.is_exist('tests/reports/test.local', 'test.local.{0}'.format(ext)))
        if ext in ['txt']:
            self.assertTrue(filesystem.is_exist('tests/reports/test.local', 'success.{0}'.format(ext)))
        shutil.rmtree('tests/reports')
Ejemplo n.º 2
0
    def is_reported(resource):
        """
        Check if session is already reported
        :param str resource: target report
        :return: bool
        """

        try:
            if None is not Reporter.external_directory:
                if not Reporter.external_directory.endswith(os.path.sep):
                    Reporter.external_directory += os.path.sep
                is_reported = filesystem.is_exist(Reporter.external_directory, resource)
            else:
                is_reported = filesystem.is_exist(Reporter.config.get('reports'), resource)
            return is_reported
        except FileSystemError as error:
            raise ReporterError(error)
Ejemplo n.º 3
0
    def is_reported(resource):
        """
        Check if session is already reported
        :param str resource: target report
        :return: bool
        """

        try:
            if None is not Reporter.external_directory:
                if not Reporter.external_directory.endswith(os.path.sep):
                    Reporter.external_directory += os.path.sep
                is_reported = filesystem.is_exist(Reporter.external_directory,
                                                  resource)
            else:
                is_reported = filesystem.is_exist(
                    Reporter.config.get('reports'), resource)
            return is_reported
        except FileSystemError as error:
            raise ReporterError(error)
Ejemplo n.º 4
0
    def is_reported(resource):
        """
        Check if session is already reported
        :param str resource: target report
        :return: bool
        """

        try:
            config = filesystem.readcfg(Reporter.config)
            return filesystem.is_exist(config.get('opendoor', 'reports'),
                                       resource)
        except FileSystemError as e:
            raise ReporterError(e.message)