Sha256: 58811341ad7c0057cded8fed38dac1496cb54d8b68a797f49f9687531dcc5f2a

Contents?: true

Size: 1.33 KB

Versions: 4

Compression:

Stored size: 1.33 KB

Contents

require 'test_helper'

class GetAccountsTest < Test::Unit::TestCase

	def setup
		# uncomment this line to debug
		#Landslider.logger = $stdout
		$sesson_id1 ||= Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)[:session_id]
	end
	
	def test_get_accounts_without_search
	
		result = Landslider.get_accounts($sesson_id1)

		assert_not_nil result
		assert_equal false, result[:error]
		assert_kind_of Array, result[:accounts]
		assert_equal 7, result[:accounts].size
		
	end
	
	def test_get_accounts_with_simple_search
	
		simple_search = Landslider::WsSearch.new({:first_result_position => 1, :total_results_requested => 1})
		result = Landslider.get_accounts($sesson_id1, simple_search)
	
		assert_not_nil result
		assert_equal false, result[:error]
		assert_kind_of Array, result[:accounts]
		assert_equal 1, result[:accounts].size
		
	end
	
	def test_get_accounts_with_search_criterion_search
		search = Landslider::WsSearch.new
		search.search_criteria = Landslider::WsSearchCriterion.new('AccountTypeId', 'Equals', '1539484')
		result = Landslider.get_accounts($sesson_id1, search)

		assert_not_nil result
		assert_equal false, result[:error]
		assert_kind_of Array, result[:accounts]
		assert_equal 2, result[:accounts].size
		assert result[:accounts].all? { |a| a[:account_type_id] == 1539484}, "account type id should match search crit"
	
	end
	
	
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
landslider-0.5.24 test/get_accounts_test.rb
landslider-0.5.22 test/get_accounts_test.rb
landslider-0.5.21 test/get_accounts_test.rb
landslider-0.5.20 test/get_accounts_test.rb