Skip to content

Commit

Permalink
update test case for checking if the response xml is valid.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhilong Hou committed Jan 20, 2017
1 parent 93c1a30 commit 84fe0f9
Show file tree
Hide file tree
Showing 30 changed files with 81 additions and 124 deletions.
2 changes: 1 addition & 1 deletion test/functional/test_activate.rb
Expand Up @@ -94,7 +94,7 @@ def test_simple_error
}

#Get exceptions
exception = assert_raise{
exception = assert_raise(RuntimeError){
LitleOnlineRequest.new.activate(hash)
}
#Test
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_activateReversal.rb
Expand Up @@ -50,7 +50,7 @@ def test_simple_error
}

#Get exceptions
exception = assert_raise{
exception = assert_raise(RuntimeError){
LitleOnlineRequest.new.activate_reversal(hash)
}
#Test
Expand Down
12 changes: 6 additions & 6 deletions test/functional/test_auth.rb
Expand Up @@ -102,7 +102,7 @@ def test_illegal_order_source
}}

#Get exceptions
exception = assert_raise{
exception = assert_raise(RuntimeError){
LitleOnlineRequest.new.authorization(hash)
}
#Test
Expand Down Expand Up @@ -159,7 +159,7 @@ def test_no_order_id
'expDate' =>'1210'
}}
#Get exceptions
exception = assert_raise{
exception = assert_raise(RuntimeError){
LitleOnlineRequest.new.authorization(hash)
}
#Test
Expand All @@ -179,7 +179,7 @@ def test_no_amount
'expDate' =>'1210'
}}
#Get exceptions
exception = assert_raise{
exception = assert_raise(RuntimeError){
LitleOnlineRequest.new.authorization(hash)
}
#Test
Expand All @@ -200,7 +200,7 @@ def test_no_order_source
'expDate' =>'1210'
}}
#Get exceptions
exception = assert_raise{
exception = assert_raise(RuntimeError){
LitleOnlineRequest.new.authorization(hash)
}
#Test
Expand All @@ -220,7 +220,7 @@ def test_authorization_missing_attributes
}}

#Get exceptions
exception = assert_raise{
exception = assert_raise(RuntimeError){
LitleOnlineRequest.new.authorization(hash)
}
#Test
Expand All @@ -239,7 +239,7 @@ def test_orderId_required
}
}
#Get exceptions
exception = assert_raise{
exception = assert_raise(RuntimeError){
LitleOnlineRequest.new.authorization(hash)
}
#Test
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_authReversal.rb
Expand Up @@ -62,7 +62,7 @@ def test_no_litle_txn_id
'payPalNotes'=>'Notes'
}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.auth_reversal(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.auth_reversal(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_balanceInquiry.rb
Expand Up @@ -74,7 +74,7 @@ def test_simple_error
}

#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.balance_inquiry(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.balance_inquiry(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_cancelSubscription.rb
Expand Up @@ -48,7 +48,7 @@ def test_simple_error
}

#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.cancel_subscription(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.cancel_subscription(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_capture.rb
Expand Up @@ -77,7 +77,7 @@ def test_no_txn_id
'amount'=>'106',
}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.capture(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.capture(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_captureGivenAuth.rb
Expand Up @@ -181,7 +181,7 @@ def test_no_amount
'expDate' =>'1210'
}}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.capture_given_auth(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.capture_given_auth(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_createPlan.rb
Expand Up @@ -79,7 +79,7 @@ def test_simple_error
}

#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.create_plan(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.create_plan(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_deactivate.rb
Expand Up @@ -74,7 +74,7 @@ def test_simple_error
}

#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.deactivate(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.deactivate(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_deactivateReversal.rb
Expand Up @@ -50,7 +50,7 @@ def test_simple_error
}

#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.deactivate_reversal(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.deactivate_reversal(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_depositReversal.rb
Expand Up @@ -50,7 +50,7 @@ def test_simple_error
}

#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.deposit_reversal(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.deposit_reversal(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
4 changes: 2 additions & 2 deletions test/functional/test_echeckCredit.rb
Expand Up @@ -46,7 +46,7 @@ def test_no_amount
'reportGroup'=>'Planets',
}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.echeck_credit(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_credit(hash)}
#Test
assert(exception.message =~ /The content of element 'echeckCredit' is not complete/)
end
Expand Down Expand Up @@ -113,7 +113,7 @@ def test_extra_field_and_missing_billing
'orderSource'=>'ecommerce',
}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.echeck_credit(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_credit(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_echeckRedeposit.rb
Expand Up @@ -82,7 +82,7 @@ def test_no_txn_id
'reportGroup'=>'Planets',
}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.echeck_redeposit(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_redeposit(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
6 changes: 3 additions & 3 deletions test/functional/test_echeckSale.rb
Expand Up @@ -35,7 +35,7 @@ def test_no_amount
'reportGroup'=>'Planets'
}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.echeck_sale(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_sale(hash)}
#Test
assert(exception.message =~ /The content of element 'echeckSale' is not complete/)
end
Expand Down Expand Up @@ -120,7 +120,7 @@ def test_extra_field_and_missing_billing
'orderSource'=>'ecommerce',
}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.echeck_sale(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_sale(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down Expand Up @@ -189,7 +189,7 @@ def test_echeck_sale_with_txnId_secondaryAmount
'secondaryAmount'=>'50'
}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.echeck_sale(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_sale(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
8 changes: 4 additions & 4 deletions test/functional/test_echeckVerification.rb
Expand Up @@ -86,7 +86,7 @@ def test_extra_field_and_missing_billing
'orderSource'=>'ecommerce',
}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.echeck_verification(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_verification(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand All @@ -99,7 +99,7 @@ def test_no_amount
'orderId'=>'12345'
}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.echeck_verification(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_verification(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand All @@ -111,7 +111,7 @@ def test_no_order_id
'reportGroup'=>'Planets',
}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.echeck_verification(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_verification(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand All @@ -125,7 +125,7 @@ def test_no_order_source
'orderId'=>'12345'
}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.echeck_verification(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_verification(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
4 changes: 2 additions & 2 deletions test/functional/test_forceCapture.rb
Expand Up @@ -117,7 +117,7 @@ def test_no_order_id
'type'=>'VI'
}}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.force_capture(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.force_capture(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand All @@ -136,7 +136,7 @@ def test_no_order_source
'expDate' =>'1210'
}}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.force_capture(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.force_capture(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_load.rb
Expand Up @@ -76,7 +76,7 @@ def test_simple_error
}

#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.load_request(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.load_request(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_loadReversal.rb
Expand Up @@ -50,7 +50,7 @@ def test_simple_error
}

#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.load_reversal(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.load_reversal(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_refundReversal.rb
Expand Up @@ -50,7 +50,7 @@ def test_simple_error
}

#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.refund_reversal(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.refund_reversal(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
8 changes: 4 additions & 4 deletions test/functional/test_sale.rb
Expand Up @@ -86,7 +86,7 @@ def test_illegal_order_source
'expDate' =>'1210'
}}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.sale(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down Expand Up @@ -179,7 +179,7 @@ def test_no_order_id
'expDate' =>'1210'
}}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.sale(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand All @@ -198,7 +198,7 @@ def test_no_amount
'expDate' =>'1210'
}}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.sale(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand All @@ -217,7 +217,7 @@ def test_no_order_source
'expDate' =>'1210'
}}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.sale(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_unload.rb
Expand Up @@ -76,7 +76,7 @@ def test_simple_error
}

#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.unload_request(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.unload_request(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_unloadReversal.rb
Expand Up @@ -50,7 +50,7 @@ def test_simple_error
}

#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.unload_reversal(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.unload_reversal(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_updatePlan.rb
Expand Up @@ -52,7 +52,7 @@ def test_simple_error
}

#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.update_plan(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.update_plan(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_updateSubscription.rb
Expand Up @@ -70,7 +70,7 @@ def test_simple_error
}

#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.update_subscription(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.update_subscription(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down
4 changes: 2 additions & 2 deletions test/functional/test_xmlfields.rb
Expand Up @@ -42,7 +42,7 @@ def test_card_no_required_type_or_track
'cardValidationNum'=> '123'
}}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.sale(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down Expand Up @@ -192,7 +192,7 @@ def test_amex_data_missing_seller_id
'amexAggregatorData'=>{'sellerMerchantCategoryCode'=>'1234'}
}
#Get exceptions
exception = assert_raise{LitleOnlineRequest.new.credit(hash)}
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.credit(hash)}
#Test
assert(exception.message =~ /Error validating xml data against the schema/)
end
Expand Down

0 comments on commit 84fe0f9

Please sign in to comment.