Skip to content

Commit

Permalink
update testing
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangbiao committed Nov 12, 2019
1 parent 5507861 commit cd9d421
Showing 1 changed file with 51 additions and 49 deletions.
100 changes: 51 additions & 49 deletions test/api_log_test.go
Original file line number Diff line number Diff line change
@@ -1,55 +1,57 @@
package main

import (
"github.com/gogf/gf/net/ghttp"
"testing"
)

//
//import (
// "github.com/gogf/gf/net/ghttp"
// "testing"
//)
//
const (
TestURL string = "http://127.0.0.1:80"
)

func TestLogTest(t *testing.T) {
if r, e := ghttp.Get(TestURL + "/tmp/test?name=john&age=18"); e != nil {
t.Error(e)
} else {
t.Log(string(r.ReadAll()))
r.Close()
}
}

func TestLogPost(t *testing.T) {
if r, e := ghttp.Post(TestURL+"/tmp/access", "name=john&age=18"); e != nil {
t.Error(e)
} else {
t.Log(string(r.ReadAll()))
r.Close()
}
}

func TestLogGet(t *testing.T) {
if r, e := ghttp.Get(TestURL + "/tmp/access?name=john&age=18"); e != nil {
t.Error(e)
} else {
t.Log(string(r.ReadAll()))
r.Close()
}
}

func TestLogCache(t *testing.T) {
if r, e := ghttp.Get(TestURL + "/tmp/cache"); e != nil {
t.Error(e)
} else {
t.Log(string(r.ReadAll()))
r.Close()
}
}

func TestLogMysql(t *testing.T) {
if r, e := ghttp.Get(TestURL + "/tmp/mysql"); e != nil {
t.Error(e)
} else {
t.Log(string(r.ReadAll()))
r.Close()
}
}
//
//func TestLogTest(t *testing.T) {
// if r, e := ghttp.Get(TestURL + "/tmp/test?name=john&age=18"); e != nil {
// t.Error(e)
// } else {
// t.Log(string(r.ReadAll()))
// r.Close()
// }
//}
//
//func TestLogPost(t *testing.T) {
// if r, e := ghttp.Post(TestURL+"/tmp/access", "name=john&age=18"); e != nil {
// t.Error(e)
// } else {
// t.Log(string(r.ReadAll()))
// r.Close()
// }
//}
//
//func TestLogGet(t *testing.T) {
// if r, e := ghttp.Get(TestURL + "/tmp/access?name=john&age=18"); e != nil {
// t.Error(e)
// } else {
// t.Log(string(r.ReadAll()))
// r.Close()
// }
//}
//
//func TestLogCache(t *testing.T) {
// if r, e := ghttp.Get(TestURL + "/tmp/cache"); e != nil {
// t.Error(e)
// } else {
// t.Log(string(r.ReadAll()))
// r.Close()
// }
//}
//
//func TestLogMysql(t *testing.T) {
// if r, e := ghttp.Get(TestURL + "/tmp/mysql"); e != nil {
// t.Error(e)
// } else {
// t.Log(string(r.ReadAll()))
// r.Close()
// }
//}

0 comments on commit cd9d421

Please sign in to comment.