Sha256: 3c00c0e7dbb083f472116fad3ead68374b096ca9b7b17d0569155a95d14ad64f

Contents?: true

Size: 576 Bytes

Versions: 4

Compression:

Stored size: 576 Bytes

Contents

require 'test_helper'

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

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

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jasl_tenpay-1.1.1 test/jasl_tenpay/sign_test.rb
jasl_tenpay-1.1.0 test/jasl_tenpay/sign_test.rb
jasl_tenpay-1.0.2 test/jasl_tenpay/sign_test.rb
jasl_tenpay-1.0.1 test/jasl_tenpay/sign_test.rb