Sha256: 3e96a3c64475fe18e56b7897f69a9e69949d48e0b85bdf60417bccf910ac3f23

Contents?: true

Size: 1.74 KB

Versions: 6

Compression:

Stored size: 1.74 KB

Contents

$:.unshift File.dirname(__FILE__)
require 'helper'
require 'tempfile'

class TaskTest < Test::Unit::TestCase

  def test_fire

    jobs_data = fixture('jobs.json')
    Bellows::SmokeStack.stubs(:jobs).returns(JSON.parse(jobs_data))
    
    smoke_tests_data = fixture('nova_smoke_tests.json')
    Bellows::HTTP.stubs(:get).returns(smoke_tests_data)

    gerrit_data = fixture('gerrit.json')
    Bellows::Gerrit.stubs(:run_cmd).returns(gerrit_data)

    response = mock()
    Bellows::HTTP.stubs(:post).returns(response)
    tasks = Bellows::Tasks.new
    tasks.fire('openstack/nova', options={:quiet => true})

  end

  def test_comment

    sample_config = fixture('config.yaml')
    Bellows::Util.stubs(:load_configs).returns(YAML::load(sample_config))

    jobs_data = fixture('jobs.json')
    Bellows::SmokeStack.stubs(:jobs).returns(JSON.parse(jobs_data))
    
    gerrit_data = fixture('gerrit.json')
    Bellows::Gerrit.stubs(:run_cmd).returns(gerrit_data)

    cache_file=Tempfile.new('smokestack')

    response = mock()
    Bellows::HTTP.stubs(:post).returns(response)
    tasks = Bellows::Tasks.new

    tasks.comment('openstack/nova', options={:quiet => true, :cache_file => cache_file.path})

  end

  def test_stream

    sample_config = fixture('config.yaml')
    Bellows::Util.stubs(:load_configs).returns(YAML::load(sample_config))

    smoke_tests_data = fixture('nova_smoke_tests.json')
    Bellows::HTTP.stubs(:get).returns(smoke_tests_data)

    cache_file=Tempfile.new('smokestack')

    response = mock()
    Bellows::HTTP.stubs(:post).returns(response)
    tasks = Bellows::Tasks.new

    stream_data = fixture('stream.json')
    Bellows::Gerrit.stubs(:stream_events_cmd).returns("echo '#{stream_data}'")

    tasks.stream(options={:quiet => true})

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bellows-2.0.5 test/test_task.rb
bellows-2.0.4 test/test_task.rb
bellows-2.0.3 test/test_task.rb
bellows-2.0.2 test/test_task.rb
bellows-2.0.1 test/test_task.rb
bellows-2.0.0 test/test_task.rb