<commit_before>require File.dirname(__FILE__) + '/test_helper'

class AssetTest < ActiveSupport::TestCase

  include ActionController::TestProcess

  def setup
    Media::Transmogrifier.verbose = true  # set to true to see all the commands being run.
    FileUtils.mkdir_p(ASSET_PRIVATE_STORAGE)
    FileUtils.mkdir_p(ASSET_PUBLIC_STORAGE)
    RemoteJob.site = 'http://localhost:3002'
  end

  def teardown
    FileUtils.rm_rf(ASSET_PRIVATE_STORAGE)
    FileUtils.rm_rf(ASSET_PUBLIC_STORAGE)
    Conf.remote_processing = Conf.remote_processing
  end

  def test_doc
    if remote_available?
      asset = TextAsset.create! :uploaded_data => upload_data('msword.doc')
      thumbnail = asset.thumbnails.select{|thumb|thumb.name == 'pdf'}.first<commit_msg>another ActionDispatch fix and now unit tests are running<commit_after>require File.dirname(__FILE__) + '/test_helper'

class AssetTest < ActiveSupport::TestCase

  include ActionDispatch::TestProcess

  def setup
    Media::Transmogrifier.verbose = true  # set to true to see all the commands being run.
    FileUtils.mkdir_p(ASSET_PRIVATE_STORAGE)
    FileUtils.mkdir_p(ASSET_PUBLIC_STORAGE)
    RemoteJob.site = 'http://localhost:3002'
  end

  def teardown
    FileUtils.rm_rf(ASSET_PRIVATE_STORAGE)
    FileUtils.rm_rf(ASSET_PUBLIC_STORAGE)
    Conf.remote_processing = Conf.remote_processing
  end

  def test_doc
    if remote_available?
      asset = TextAsset.create! :uploaded_data => upload_data('msword.doc')
      thumbnail = asset.thumbnails.select{|thumb|thumb.name == 'pdf'}.first
{'fraction_non_alphanumeric': 0.08903225806451613, 'fraction_numerical': 0.005161290322580645, 'mean_word_length': 4.559139784946237, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7193925', 'n_tokens_mistral': 527, 'n_tokens_neox': 499, 'n_words': 97}