Sha256: 4f981a20511e7bc9ddc38b98543936b554c0ab64ffcb02d068310fc045542da5

Contents?: true

Size: 1.14 KB

Versions: 8

Compression:

Stored size: 1.14 KB

Contents

require "test_birst_command"

class Test_command_helper < Test::Unit::TestCase

  # Decided that commands should return whatever the Birst API returns.
  # However, for user code, it would be helpful to customize returns for
  # specific use cases

  class Session < Birst_Command::Session
    def list_spaces(*args)
      result = command __method__, *args
      [result[:user_space]].flatten
    end 
    def list_users_in_space(*args)
      result = command __method__, *args
      [result[:string]].flatten
    end
 end


  def setup
    Birst_Command::Config.read_config
    Birst_Command::Config.read_config(File.join(File.dirname(__FILE__),"../config_test.json"))
  end

  def teardown
  end

  def test_add_user_to_space
    test_options = Birst_Command::Config.options[:test][:test_add_user_to_space]

    spaces = nil
    users = nil
    Session.start do |bc|
      spaces = bc.list_spaces
      users = bc.list_users_in_space :spaceID => test_options[:space_id]
    end

    assert spaces.is_a?(Array), "list_spaces helper did not return an array"
    assert !spaces[0].has_key?(:user_space), "list_spaces helper should not give :user_space"
  end
end


Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
Birst_Command-0.5.0 test/standard/test_command_helper.rb
Birst_Command-0.4.0 test/standard/test_command_helper.rb
Birst_Command-0.3.0 test/standard/test_command_helper.rb
Birst_Command-0.2.2 test/standard/test_command_helper.rb
Birst_Command-0.2.1 test/standard/test_command_helper.rb
Birst_Command-0.2.0 test/standard/test_command_helper.rb
Birst_Command-0.1.1 test/standard/test_command_helper.rb
Birst_Command-0.1.0 test/standard/test_command_helper.rb