mirror of
https://github.com/simon987/task_tracker.git
synced 2025-12-12 06:28:50 +00:00
Logging config
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"crypto"
|
||||
"crypto/hmac"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"src/task_tracker/api"
|
||||
"src/task_tracker/config"
|
||||
@@ -16,8 +15,6 @@ func TestWebHookNoSignature(t *testing.T) {
|
||||
|
||||
r := Post("/git/receivehook", api.GitPayload{})
|
||||
|
||||
fmt.Println(r.StatusCode)
|
||||
|
||||
if r.StatusCode != 403 {
|
||||
t.Error()
|
||||
}
|
||||
@@ -31,8 +28,6 @@ func TestWebHookInvalidSignature(t *testing.T) {
|
||||
client := http.Client{}
|
||||
r, _ := client.Do(req)
|
||||
|
||||
fmt.Println(r.StatusCode)
|
||||
|
||||
if r.StatusCode != 403 {
|
||||
t.Error()
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package test
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@@ -15,7 +14,7 @@ func Post(path string, x interface{}) *http.Response {
|
||||
body, err := json.Marshal(x)
|
||||
buf := bytes.NewBuffer(body)
|
||||
|
||||
r, err := http.Post("http://" + config.Cfg.ServerAddr + path, "application/json", buf)
|
||||
r, err := http.Post("http://"+config.Cfg.ServerAddr+path, "application/json", buf)
|
||||
handleErr(err)
|
||||
|
||||
return r
|
||||
@@ -28,18 +27,12 @@ func Get(path string) *http.Response {
|
||||
return r
|
||||
}
|
||||
|
||||
|
||||
func handleErr(err error) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func Print(body io.ReadCloser) {
|
||||
rawBody, _ := ioutil.ReadAll(body)
|
||||
fmt.Println(string(rawBody))
|
||||
}
|
||||
|
||||
func GenericJson(body io.ReadCloser) map[string]interface{} {
|
||||
|
||||
var obj map[string]interface{}
|
||||
@@ -50,4 +43,4 @@ func GenericJson(body io.ReadCloser) map[string]interface{} {
|
||||
handleErr(err)
|
||||
|
||||
return obj
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,12 @@ server:
|
||||
address: "127.0.0.1:5001"
|
||||
|
||||
database:
|
||||
conn_str : "user=task_tracker dbname=task_tracker_test sslmode=disable"
|
||||
conn_str: "user=task_tracker dbname=task_tracker_test sslmode=disable"
|
||||
|
||||
git:
|
||||
webhook_secret: "very_secret_secret"
|
||||
webhook_hash: "sha1"
|
||||
webhook_sig_header: "X-Hub-Signature"
|
||||
|
||||
log:
|
||||
level: "trace"
|
||||
Reference in New Issue
Block a user