Sha256: cab867e3e43e50d6b625a2aa48d2d2dbd1b9b91b079f07bdb173761f89709f67

Contents?: true

Size: 1004 Bytes

Versions: 9

Compression:

Stored size: 1004 Bytes

Contents

require 'test_helper'

class Alipay::NotifyTest < Minitest::Test
  def setup
    @params = {
      notify_id: '1234',
    }
    @unsign_params = @params.merge(sign_type: 'MD5', sign: 'xxxx')
    @sign_params = @params.merge(
      sign_type: 'MD5',
      sign: '22fc7e38e5acdfede396aa463870d111'
    )
  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?(@unsign_params)
  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_params)
  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_params)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
alipay-0.13.0 test/alipay/notify_test.rb
alipay-0.12.0 test/alipay/notify_test.rb
alipay-0.11.0 test/alipay/notify_test.rb
alipay-0.10.0 test/alipay/notify_test.rb
alipay-0.9.0 test/alipay/notify_test.rb
alipay-0.8.0 test/alipay/notify_test.rb
alipay-0.7.1 test/alipay/notify_test.rb
alipay-0.7.0 test/alipay/notify_test.rb
alipay-0.6.0 test/alipay/notify_test.rb