Sha256: b324c6c28a03c7fc2b1bcaa300af7ff5d55cf8f4f21d2e5942dce05f9e098b61
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
require 'test_helper' class Tenpay::NotifyTest < Test::Unit::TestCase SUCCESS_RETURN = <<-XML <?xml version="1.0" encoding="GBK"?> <root> <input_charset>UTF-8</input_charset> <partner>2000054321</partner> <retcode>0</retcode> <retmsg /> <sign>1C58B3A778D9F49F3FA91D30E9A831D2</sign> <sign_key_index>1</sign_key_index> <sign_type>MD5</sign_type> </root> XML FAIL_RETURN = <<-XML <?xml version="1.0" encoding="GBK"?> <root> <input_charset>UTF-8</input_charset> <partner>2000054321</partner> <retcode>88222005</retcode> <retmsg /> <sign>1C58B3A778D9F49F3FA91D30E9A831D2</sign> <sign_key_index>1</sign_key_index> <sign_type>MD5</sign_type> </root> XML def setup @options = { :notify_id => '123456789012345678901234567890', :sign => '9E3178005EF2DFF87348E00889765FF0' } @url = "https://gw.tenpay.com/gateway/simpleverifynotifyid.xml?input_charset=UTF-8&partner=#{Tenpay.pid}¬ify_id=123456789012345678901234567890&sign=E040AFBCBC409EA0C62CF0F11CF0BAA4" end def test_verify_notify_when_true FakeWeb.register_uri(:get, @url, :body => SUCCESS_RETURN) assert Tenpay::Notify.verify?(@options) end def test_verify_notify_when_false FakeWeb.register_uri(:get, @url, :body => FAIL_RETURN) assert !Tenpay::Notify.verify?(@options) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jasl_tenpay-1.0.0 | test/tenpay/notify_test.rb |
jasl_tenpay-0.0.2 | test/tenpay/notify_test.rb |