Sha256: c3130ccedc7ee52329a7027378021bf87127fb91840c058edd8e703bab98f37d

Contents?: true

Size: 653 Bytes

Versions: 9

Compression:

Stored size: 653 Bytes

Contents

require 'test_helper'

class Alipay::Sign::RSATest < Minitest::Test
  def setup
    @string = "partner=123&service=test"
    @sign = "TaVXdP/0ia5NxIv9T76v6vGOrtgoaFrwnchKIWP9PQeX1UkUVxaq6ejDFmXFrFR+Plk+E/XzfV2DYJSVt0Am0qJRSgeg+PuvK+yWGCGm9GJgUJlS4Eyta3g+8DWwRWTjUyh5yzlf9JoSnbNjYpBolnMRD7B/u1JLkTMJuMx2TVM="
  end

  def test_sign
    assert_equal @sign, Alipay::Sign::RSA.sign(TEST_RSA_PRIVATE_KEY, @string)
  end

  def test_verify
    assert Alipay::Sign::RSA.verify?(TEST_RSA_PUBLIC_KEY, @string, @sign)
  end

  def test_verify_fail_when_sign_not_true
    assert !Alipay::Sign::RSA.verify?(TEST_RSA_PUBLIC_KEY, "danger#{@string}", @sign)
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
yl_alipay-0.15.3 test/alipay/sign/rsa_test.rb
yl_alipay-0.15.2 test/alipay/sign/rsa_test.rb
alipay-0.14.0 test/alipay/sign/rsa_test.rb
alipay-0.13.0 test/alipay/sign/rsa_test.rb
alipay-0.12.0 test/alipay/sign/rsa_test.rb
alipay-0.11.0 test/alipay/sign/rsa_test.rb
alipay-0.10.0 test/alipay/sign/rsa_test.rb
alipay-0.9.0 test/alipay/sign/rsa_test.rb
alipay-0.8.0 test/alipay/sign/rsa_test.rb