Пример #1
0
func new_ts() *httptest.Server {
	ts := httptest.NewMuxServer()
	ts.mux.HFunc("/route/dadd", DriverAddRoute)
	ts.mux.HFunc("/route/padd", PassengerJoinRoute)
	ts.mux.HFunc("/route/pfind", PassengerFindDriver)
	return ts
}
Пример #2
0
func TestAlipay(t *testing.T) {
	var client = NewClient("https://mapi.alipay.com/gateway.do", nil)
	fmt.Println(client.CreateUrl("Web", "http://pb.dev.jxzy.com/_echo_", "http://pb.dev.jxzy.com/_echo_", "6843192280647119", "abcc", "223", 0.01))
	fmt.Println(client.CreateUrl("APP", "http://pb.dev.jxzy.com/_echo_", "http://pb.dev.jxzy.com/_echo_", "6843192280647119", "abcc", "223", 0.01))
	var ts = httptest.NewMuxServer()
	ts.Mux.HFunc("^/return(\\?.*)?$", client.Return)
	fmt.Println(ts.G("/return?%v", "body=223&buyer_email=centny%40gmail.com&buyer_id=2088102972036594&exterface=create_direct_pay_by_user&is_success=T&notify_id=RqPnCoPT3K9%252Fvwbh3InWfjSquPZ53GKZDlpLiPerRyczkZ1BqSCeryalHBnmC%252FQ3uhhI&notify_time=2016-08-04+11%3A15%3A02&notify_type=trade_status_sync&out_trade_no=6843192280647112&payment_type=1&seller_email=itdayang%40gmail.com&seller_id=2088501949844011&subject=abcc&total_fee=0.01&trade_no=2016080421001004590289703858&trade_status=TRADE_SUCCESS&sign=f98956240273d3bda99b84c9a64c27a4&sign_type=MD5"))
}
Пример #3
0
func TestG(t *testing.T) {
	var ts = httptest.NewMuxServer()
	os.Args = []string{"ffcm", "-g", "http://127.0.0.1:23243"}
	main()
	os.Args = []string{"ffcm", "-g", ts.URL}
	main()
	os.Args = []string{"ffcm", "-g"}
	main()
}
Пример #4
0
func TestCov(t *testing.T) {
	os.Setenv("PATH", "/usr/local/bin:"+os.Getenv("PATH"))
	var ts = httptest.NewMuxServer()
	ts.Mux.HFunc("^.*$", func(hs *routing.HTTPSession) routing.HResult {
		ioutil.ReadAll(hs.R.Body)
		return routing.HRES_RETURN
	})
	os.Args = []string{"ffmpeg", "-cov", ts.URL, "../xx.mp4", "1280", "720", "1024", "768", "tmp/abc.mp4", "out/abc.mp4", "abc.mp4"}
	main()
}