Sha256: 465bab5d04afdf66231752c996b00b769e3ba58125bbf3aa3d92c98a9e2dd681

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

# -*- coding: utf-8 -*-
$:.unshift(File.dirname(__FILE__))
$:.unshift(File.dirname(__FILE__) + "/.." + "/lib")

require 'helper'

class Magpie::UtilsTest < Test::Unit::TestCase
  include Magpie::Utils


  def test_send_notify_timeout
    url = "bad_url"
    res = send_notify("post", url, "")
    assert res.is_a?(String)
    assert res.include?("请确认#{url}在你的商户系统中可用")
  end

  def test_send_notify_code
    url = "http://piao.fantong.com/alipay/notify"
    res = send_notify("POST", url, { })
    assert res.include?("fail")
    url = "http://piao.fantong.com/alipay/page_not_exit"
    res = send_notify("post", url, { })
    assert res.include?("请确认#{url}在你的商户系统中可用")
    url = "http://piao.fantong.com/chinabank/feedback"
    res = send_notify("post", url, { })
    assert res.include?("redirected")
    url = "http://piao.fantong.com/tenpay/notify"
    res = send_notify("post", url, { })
    assert res.include?("请确认#{url}在你的商户系统中可用")
    res = send_notify("get", url, "")
    assert !res.include?("请确认#{url}在你的商户系统中可用")
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
magpie-0.8.8.1 test/test_utils.rb
magpie-0.8.8 test/test_utils.rb