Sha256: fe195f0f67b18bb4555c64f1363a0046742b08a14070ccf9a4bb5a697eee26bf

Contents?: true

Size: 659 Bytes

Versions: 3

Compression:

Stored size: 659 Bytes

Contents

require 'test_helper'

class Alipay::Sign::RSATest < Minitest::Test
  def setup
    @string = "partner=123&service=test"
    @sign = "TaVXdP/0ia5NxIv9T76v6vGOrtgoaFrwnchKIWP9PQeX1UkUVxaq6ejDFmXF\nrFR+Plk+E/XzfV2DYJSVt0Am0qJRSgeg+PuvK+yWGCGm9GJgUJlS4Eyta3g+\n8DWwRWTjUyh5yzlf9JoSnbNjYpBolnMRD7B/u1JLkTMJuMx2TVM=\n"
  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

3 entries across 3 versions & 1 rubygems

Version Path
alipay-0.7.1 test/alipay/sign/rsa_test.rb
alipay-0.7.0 test/alipay/sign/rsa_test.rb
alipay-0.6.0 test/alipay/sign/rsa_test.rb