Beispiel #1
0
  def test_setup_environment_and_remove_temp_files(self):
    """
    Test if the temporary files are deleted.
    """
    conf_file = os.path.join('conf', CONFIG_FILE)
    config = SafeConfigParser()
    config.read(conf_file)

    scanner = Scanner(config)
    scanner.log_dir = os.path.join(scanner.logroot_dir, 'test_remove_temp_files')
    scanner.tmp_dir = 'test_remove_temp_files'
    scanner.creative_db = 'sqlite:///%s/creative.db' % scanner.log_dir

    scanner.setup_environment()
    assert os.path.exists(scanner.workspace.dirname)

    scanner.remove_temp_files()
    self.assertFalse(os.path.exists(scanner.workspace.dirname))

    adscan.fs.rmdirs(scanner.log_dir)
    adscan.fs.rmdirs(scanner.tmp_dir)
Beispiel #2
0
    def test_setup_environment_and_remove_temp_files(self):
        """
    Test if the temporary files are deleted.
    """
        conf_file = os.path.join('conf', CONFIG_FILE)
        config = SafeConfigParser()
        config.read(conf_file)

        scanner = Scanner(config)
        scanner.log_dir = os.path.join(scanner.logroot_dir,
                                       'test_remove_temp_files')
        scanner.tmp_dir = 'test_remove_temp_files'
        scanner.creative_db = 'sqlite:///%s/creative.db' % scanner.log_dir

        scanner.setup_environment()
        assert os.path.exists(scanner.workspace.dirname)

        scanner.remove_temp_files()
        self.assertFalse(os.path.exists(scanner.workspace.dirname))

        adscan.fs.rmdirs(scanner.log_dir)
        adscan.fs.rmdirs(scanner.tmp_dir)
Beispiel #3
0
  def test_compress_log_file(self):
    """
    Test if the log file is compressed.
    """
    conf_file = os.path.join('conf', CONFIG_FILE)
    config = SafeConfigParser()
    config.read(conf_file)

    scanner = Scanner(config)
    scanner.log_dir = os.path.join(scanner.logroot_dir, 'test_compress_log_file')

    tarname = '%s.tgz' % scanner.log_dir

    scanner.setup_environment()
    assert os.path.exists(scanner.log_dir)
    if os.path.exists(tarname):
      os.remove(tarname)

    scanner.compress_log_file()
    assert os.path.exists(tarname)

    adscan.fs.rmdirs(scanner.log_dir)
    os.remove(tarname)
Beispiel #4
0
    def test_compress_log_file(self):
        """
    Test if the log file is compressed.
    """
        conf_file = os.path.join('conf', CONFIG_FILE)
        config = SafeConfigParser()
        config.read(conf_file)

        scanner = Scanner(config)
        scanner.log_dir = os.path.join(scanner.logroot_dir,
                                       'test_compress_log_file')

        tarname = '%s.tgz' % scanner.log_dir

        scanner.setup_environment()
        assert os.path.exists(scanner.log_dir)
        if os.path.exists(tarname):
            os.remove(tarname)

        scanner.compress_log_file()
        assert os.path.exists(tarname)

        adscan.fs.rmdirs(scanner.log_dir)
        os.remove(tarname)