# require 'test_helper' # # module RubyPsigate # class AccountManagerApiTest < Test::Unit::TestCase # # def setup # @valid_instance_opts = { # :cid => '1000001', :login => 'teststore', :password => 'testpass' # } # @am = AccountManagerApi.new(@valid_instance_opts) # # @valid_register_opts = { # :name => "Bob Parsons", # :company => "Scaler Apps", # :address1 => "1234 10th Avenue", # :address2 => "Unit 123", # :city => "Toronto", # :province => "ON", # :country => "Canada", # :postal_code => "M2N9J9", # :phone => "416-123-1234", # :fax => "416-321-4321", # :email => "hello@world.com", # :comments => "No comments here. Move on.", # :card_holder => "Bob Parsons", # :card_number => "4111111111111111", # :card_exp_month => (Time.now.month).to_s, # :card_exp_year => (Time.now.year+1).to_s # } # # end # # context "constants" do # def test_test_url # assert_equal AccountManagerApi::TEST_URL, 'https://dev.psigate.com:8645/Messenger/AMMessenger' # end # end # # context "new instance" do # %w( cid login password ).each do |p| # should "raise error when instantiating a new instance without the parameter #{p}" do # @valid_instance_opts.delete(p.to_sym) # assert_raises(ArgumentError) { AccountManagerApi.new(@valid_instance_opts) } # end # end # end # # context "registering an account" do # %w( name address1 city province country postal_code phone email card_holder card_number card_exp_month card_exp_year ).each do |p| # should "raise error if #{p} is not included" do # @valid_register_opts.delete(p.to_sym) # assert_raises(ArgumentError) { @am.register(@valid_register_opts) } # end # end # # %w( company address2 fax comments ).each do |p| # should "not raise error if #{p} is not included" do # @valid_register_opts.delete(p.to_sym) # assert_nothing_raised { @am.register(@valid_register_opts) } # end # end # # # should "form a valid request" do # # valid_request = <<-EOF # # # # 1000001 # # teststore # # testpass # # AMA00 # # # # 1234567890 # # # # # # EOF # # # # end # end # # context "retrieving an account summary" do # should "raise error if account_id is not included" do # assert_raises(ArgumentError) { @am.retrieve_summary } # end # # should "form a valid request" do # # => Move this to remote test # # response = @am.retrieve_summary(:account_id => "1234567890") # # assert_success response # end # end # # # # # # end # end