Sha256: 37d6a588c77706d552f735d5d02882641d947e42e987072293044aa8eea7df72

Contents?: true

Size: 938 Bytes

Versions: 12

Compression:

Stored size: 938 Bytes

Contents

require 'test_helper'

class Alipay::NotifyTest < Test::Unit::TestCase
  def setup
    @options = {
      :notify_id => '1234'
    }
    @sign_options = @options.merge(:sign_type => 'MD5', :sign => Alipay::Sign.generate(@options))
  end

  def test_unsign_notify
    FakeWeb.register_uri(:get, "https://mapi.alipay.com/gateway.do?service=notify_verify&partner=#{Alipay.pid}&notify_id=1234", :body => "true")
    assert !Alipay::Notify.verify?(@options)
  end

  def test_verify_notify_when_true
    FakeWeb.register_uri(:get, "https://mapi.alipay.com/gateway.do?service=notify_verify&partner=#{Alipay.pid}&notify_id=1234", :body => "true")
    assert Alipay::Notify.verify?(@sign_options)
  end

  def test_verify_notify_when_false
    FakeWeb.register_uri(:get, "https://mapi.alipay.com/gateway.do?service=notify_verify&partner=#{Alipay.pid}&notify_id=1234", :body => "false")
    assert !Alipay::Notify.verify?(@sign_options)
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
alipay-0.5.0 test/alipay/notify_test.rb
alipay-0.4.1 test/alipay/notify_test.rb
alipay-0.4.0 test/alipay/notify_test.rb
alipay-0.3.1 test/alipay/notify_test.rb
alipay-0.3.0 test/alipay/notify_test.rb
alipay-0.2.0 test/alipay/notify_test.rb
alipay-0.1.0 test/alipay/notify_test.rb
alipay-0.0.5 test/alipay/notify_test.rb
alipay-0.0.4 test/alipay/notify_test.rb
alipay-0.0.3 test/alipay/notify_test.rb
alipay-0.0.2 test/alipay/notify_test.rb
alipay-0.0.1 test/alipay/notify_test.rb