Sha256: 0f6c8d88923e2bf6778e439e4162dcac659655bdee94ad21e798ad0a14e8db58

Contents?: true

Size: 1.98 KB

Versions: 4

Compression:

Stored size: 1.98 KB

Contents

require 'helper'
require 'tmpdir'

class BlackBoxTest < Test::Unit::TestCase

  ASSIGN_DATADIR = "test/data/assign"
  
  def test_without_parameters
    #This test does not make a whole lot of sense...
    result = %x[bin/phyta-assign]
    expected = "Invalid arguments, see --help for more information."
    assert_equal expected.strip, result.strip
  end

  def test_default_filter
    Dir.mktmpdir do |dir|
      %x[bin/phyta-assign -i #{ASSIGN_DATADIR}/in_medium.xml -o #{dir}/out_default_filter.csv]
      result = File.open("#{dir}/out_default_filter.csv").read
      target = File.open("#{ASSIGN_DATADIR}/target_default_filter.csv").read

      assert_not_nil result
      assert_not_nil target

      assert_block "Output of out_medium.xml invalid." do
        result == target
      end
    end
  end

  def test_invalid_filter
    Dir.mktmpdir do |dir|
      response = %x[bin/phyta-assign -i #{ASSIGN_DATADIR}/in_medium.xml -o #{dir}/out_default_filter.csv -f #{ASSIGN_DATADIR}/in_medium.xml]
      assert response.include? "Error"
      assert !File.exist?("#{dir}/out_default_filter.csv")
    end
  end
    
  def test_small
    Dir.mktmpdir do |dir|
      res = %x[bin/phyta-assign -i #{ASSIGN_DATADIR}/in_3.xml -o #{dir}/out_3.csv -f #{SPLIT_DATADIR}/../common/default_filter.yaml]

      result = File.open("#{dir}/out_3.csv").read
      target = File.open("#{ASSIGN_DATADIR}/target_3.csv").read

      assert_not_nil result
      assert_not_nil target

      assert_equal target, result, "Output of out_3.xml invalid"
    end
  end

  def test_medium
    Dir.mktmpdir do |dir|
      %x[bin/phyta-assign -i #{ASSIGN_DATADIR}/in_medium.xml -o #{dir}/out_medium.csv -f #{SPLIT_DATADIR}/../common/default_filter.yaml]
      result = File.open("#{dir}/out_medium.csv").read
      target = File.open("#{ASSIGN_DATADIR}/target_medium.csv").read

      assert_not_nil result
      assert_not_nil target

      assert_block "Output of out_medium.xml invalid." do
        result == target
      end
    end
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bio-phyta-0.9.4 test/test_blackbox_assign.rb
bio-phyta-0.9.3 test/test_blackbox_assign.rb
bio-phyta-0.9.2 test/test_blackbox_assign.rb
bio-phyta-0.9.1 test/test_blackbox_assign.rb