add go functest
This commit is contained in:
parent
587e6d8089
commit
9acc1c33be
|
@ -1,5 +1,5 @@
|
||||||
command: python -m pytest {}
|
command: go test -v {}
|
||||||
include: ^test_.*\.py$
|
include: ^.+_test\.go$
|
||||||
path: ./
|
path: ./
|
||||||
depth: 1
|
depth: 1
|
||||||
verbose: true
|
verbose: true
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
this is for developers
|
this is for developers
|
||||||
|
|
||||||
## prepare environment
|
## prepare environment
|
||||||
# install python dependency
|
|
||||||
pip install pytest
|
|
||||||
# install basic test tool
|
|
||||||
go get -u github.com/shxsun/travelexec
|
go get -u github.com/shxsun/travelexec
|
||||||
# start gogs server
|
# start gogs server
|
||||||
gogs web
|
gogs web
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestMain(t *testing.T) {
|
||||||
|
r, err := http.Get("http://localhost:3000/")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
defer r.Body.Close()
|
||||||
|
if r.StatusCode != http.StatusOK {
|
||||||
|
t.Error(r.StatusCode)
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,13 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# coding: utf-8
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
import requests
|
|
||||||
|
|
||||||
HOST = 'http://localhost:3000'
|
|
||||||
|
|
||||||
def test_index_get():
|
|
||||||
r = requests.get(HOST + '/')
|
|
||||||
assert r.status_code == 200
|
|
||||||
|
|
Loading…
Reference in New Issue