Sha256: 278a57c9b6c3299ce80822538d5a73e1f67ae937229514af2de578a2c911e9e8

Contents?: true

Size: 544 Bytes

Versions: 12

Compression:

Stored size: 544 Bytes

Contents

require 'test_helper'

class Alipay::SignTest < Test::Unit::TestCase
  def setup
    @params = {
      :service => 'test',
      :partner => '123'
    }
    @sign = Digest::MD5.hexdigest("partner=123&service=test#{Alipay.key}")
  end

  def test_generate_sign
    assert_equal @sign, Alipay::Sign.generate(@params)
  end

  def test_verify_sign
    assert Alipay::Sign.verify?(@params.merge(:sign => @sign))
  end

  def test_verify_sign_when_fails
    assert !Alipay::Sign.verify?(@params.merge(:danger => 'danger', :sign => @sign))
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

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