grim/resticide

gofmt
develop
2016-07-06, Gary Kramlich
3c333cf35248
Parents 5b18ac81fe88
Children 6be74d5a96fb
gofmt
--- a/assets.go Tue Jun 28 15:14:39 2016 -0500
+++ b/assets.go Wed Jul 06 13:09:54 2016 -0500
@@ -83,7 +83,7 @@
return nil, err
}
- info := bindataFileInfo{name: "assets/schema.json", size: 6338, mode: os.FileMode(420), modTime: time.Unix(1447473136, 0)}
+ info := bindataFileInfo{name: "assets/schema.json", size: 6338, mode: os.FileMode(420), modTime: time.Unix(1448897734, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@@ -182,6 +182,7 @@
Func func() (*asset, error)
Children map[string]*bintree
}
+
var _bintree = &bintree{nil, map[string]*bintree{
"assets": &bintree{nil, map[string]*bintree{
"schema.json": &bintree{assetsSchemaJson, map[string]*bintree{}},
@@ -234,4 +235,3 @@
cannonicalName := strings.Replace(name, "\\", "/", -1)
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
}
-
--- a/console_reporter.go Tue Jun 28 15:14:39 2016 -0500
+++ b/console_reporter.go Wed Jul 06 13:09:54 2016 -0500
@@ -10,7 +10,7 @@
type ConsoleReporter struct {
verbose bool
- lock *sync.Mutex
+ lock *sync.Mutex
}
func (reporter *ConsoleReporter) Init(verbose bool) {
--- a/loader.go Tue Jun 28 15:14:39 2016 -0500
+++ b/loader.go Wed Jul 06 13:09:54 2016 -0500
@@ -12,8 +12,8 @@
)
type test_data struct {
- Name string `json:"name"`
- Request TestRequest `json:"request"`
+ Name string `json:"name"`
+ Request TestRequest `json:"request"`
Requests []TestRequest `json:"requests"`
}
--- a/reporter.go Tue Jun 28 15:14:39 2016 -0500
+++ b/reporter.go Wed Jul 06 13:09:54 2016 -0500
@@ -12,7 +12,7 @@
type Reporter struct {
handlers []ReportHandler
- verbose bool
+ verbose bool
}
type HandlerFunc func(handler ReportHandler)
@@ -25,48 +25,48 @@
return reporter
}
-func (reporter *Reporter)report(function HandlerFunc) {
+func (reporter *Reporter) report(function HandlerFunc) {
for _, handler := range reporter.handlers {
function(handler)
}
}
-func (reporter *Reporter)AddHandler(handler ReportHandler) {
+func (reporter *Reporter) AddHandler(handler ReportHandler) {
handler.Init(reporter.verbose)
reporter.handlers = append(reporter.handlers, handler)
}
-func (reporter *Reporter)Start(tests int) {
+func (reporter *Reporter) Start(tests int) {
reporter.report(func(handler ReportHandler) {
handler.Start(tests)
})
}
-func (reporter *Reporter)Finish(tests int, passed int, failed int) {
+func (reporter *Reporter) Finish(tests int, passed int, failed int) {
reporter.report(func(handler ReportHandler) {
handler.Finish(tests, passed, failed)
})
}
-func (reporter *Reporter)TestStart(test Test) {
+func (reporter *Reporter) TestStart(test Test) {
reporter.report(func(handler ReportHandler) {
handler.TestStart(test)
})
}
-func (reporter *Reporter)TestFinish(test Test, res TestResult) {
+func (reporter *Reporter) TestFinish(test Test, res TestResult) {
reporter.report(func(handler ReportHandler) {
handler.TestFinish(test, res)
})
}
-func (reporter *Reporter)LoadTestsFailed(err error) {
+func (reporter *Reporter) LoadTestsFailed(err error) {
reporter.report(func(handler ReportHandler) {
handler.LoadTestsFailed(err)
})
}
-func (reporter *Reporter)LoadTestFailed(path string, err error) {
+func (reporter *Reporter) LoadTestFailed(path string, err error) {
reporter.report(func(handler ReportHandler) {
handler.LoadTestFailed(path, err)
})
--- a/reporter_test.go Tue Jun 28 15:14:39 2016 -0500
+++ b/reporter_test.go Wed Jul 06 13:09:54 2016 -0500
@@ -1,44 +1,44 @@
package main
-
+
import (
"testing"
)
type MockHandler struct {
- init bool
- start bool
- finish bool
- testStart bool
- testFinish bool
+ init bool
+ start bool
+ finish bool
+ testStart bool
+ testFinish bool
loadTestsFailed bool
- loadTestFailed bool
+ loadTestFailed bool
}
-func (m *MockHandler)Init(v bool) {
+func (m *MockHandler) Init(v bool) {
m.init = true
}
-func (m *MockHandler)Start(t int) {
+func (m *MockHandler) Start(t int) {
m.start = true
}
-func (m *MockHandler)Finish(t int, p int, f int) {
+func (m *MockHandler) Finish(t int, p int, f int) {
m.finish = true
}
-func (m *MockHandler)TestStart(t Test) {
+func (m *MockHandler) TestStart(t Test) {
m.testStart = true
}
-func (m *MockHandler)TestFinish(t Test, r TestResult) {
+func (m *MockHandler) TestFinish(t Test, r TestResult) {
m.testFinish = true
}
-func (m *MockHandler)LoadTestsFailed(e error) {
+func (m *MockHandler) LoadTestsFailed(e error) {
m.loadTestsFailed = true
}
-func (m *MockHandler)LoadTestFailed(p string, e error) {
+func (m *MockHandler) LoadTestFailed(p string, e error) {
m.loadTestFailed = true
}
@@ -47,7 +47,7 @@
for _, v := range vals {
r := NewReporter(v)
-
+
if r.verbose != v {
t.Errorf("verbose flag was not honored")
}
--- a/runner.go Tue Jun 28 15:14:39 2016 -0500
+++ b/runner.go Wed Jul 06 13:09:54 2016 -0500
@@ -58,7 +58,7 @@
close(result_chan)
result_wg.Wait()
- reporter.Finish(n_tests, passed, n_tests - passed)
+ reporter.Finish(n_tests, passed, n_tests-passed)
failed := n_tests - passed
--- a/test.go Tue Jun 28 15:14:39 2016 -0500
+++ b/test.go Wed Jul 06 13:09:54 2016 -0500
@@ -8,10 +8,10 @@
type Test struct {
Filename string
- Name string
+ Name string
Requests []TestRequest
- Start time.Time
- End time.Time
+ Start time.Time
+ End time.Time
Duration time.Duration
}
--- a/test_form_data.go Tue Jun 28 15:14:39 2016 -0500
+++ b/test_form_data.go Wed Jul 06 13:09:54 2016 -0500
@@ -1,7 +1,7 @@
package main
type TestFormData struct {
- Value string `json:"value"`
- Json map[string]interface{} `json:"json"`
- Filename string `json:"filename"`
+ Value string `json:"value"`
+ Json map[string]interface{} `json:"json"`
+ Filename string `json:"filename"`
}
--- a/test_form_data_test.go Tue Jun 28 15:14:39 2016 -0500
+++ b/test_form_data_test.go Wed Jul 06 13:09:54 2016 -0500
@@ -8,15 +8,15 @@
func TestFormDataTagsTest(t *testing.T) {
fd := &TestFormData{}
- fields := map[string]string {
- "Value": "value",
- "Json": "json",
+ fields := map[string]string{
+ "Value": "value",
+ "Json": "json",
"Filename": "filename",
}
for g, j := range fields {
field, ok := reflect.TypeOf(fd).Elem().FieldByName(g)
-
+
if ok != true {
t.Errorf("failed to find field %s", g)
}
--- a/test_request.go Tue Jun 28 15:14:39 2016 -0500
+++ b/test_request.go Wed Jul 06 13:09:54 2016 -0500
@@ -2,8 +2,8 @@
import (
"bytes"
+ "crypto/md5"
"crypto/sha256"
- "crypto/md5"
"encoding/json"
"fmt"
"io"
@@ -19,19 +19,19 @@
)
type TestRequest struct {
- Path string `json:"path"`
- Query map[string]string `json:"query"`
- Headers map[string]string `json:"headers"`
- Method string `json:"method"`
- Body string `json:"body"`
- FormData map[string]TestFormData `json:"form-data"`
- URLEncoded map[string]string `json:"x-www-form-urlencoded"`
- Binary string `json:"binary"`
- Json interface{} `json:"json"`
- Response TestResponse `json:"response"`
+ Path string `json:"path"`
+ Query map[string]string `json:"query"`
+ Headers map[string]string `json:"headers"`
+ Method string `json:"method"`
+ Body string `json:"body"`
+ FormData map[string]TestFormData `json:"form-data"`
+ URLEncoded map[string]string `json:"x-www-form-urlencoded"`
+ Binary string `json:"binary"`
+ Json interface{} `json:"json"`
+ Response TestResponse `json:"response"`
}
-func (req *TestRequest)buildBody(test *Test) (io.Reader, string) {
+func (req *TestRequest) buildBody(test *Test) (io.Reader, string) {
body := &bytes.Buffer{}
content_type := "application/html"
@@ -103,7 +103,7 @@
return body, content_type
}
-func (req *TestRequest)buildRequest(test *Test, url *url.URL) (*http.Request, error) {
+func (req *TestRequest) buildRequest(test *Test, url *url.URL) (*http.Request, error) {
var test_url = *url
test_url.Path = req.Path
@@ -134,7 +134,7 @@
return hreq, nil
}
-func (req *TestRequest)compareResponse(res *TestResult, hresp *http.Response) {
+func (req *TestRequest) compareResponse(res *TestResult, hresp *http.Response) {
res.HttpResponse = *hresp
// first check the resp code
--- a/test_request_test.go Tue Jun 28 15:14:39 2016 -0500
+++ b/test_request_test.go Wed Jul 06 13:09:54 2016 -0500
@@ -11,22 +11,22 @@
func TestRequestTagsTest(t *testing.T) {
fd := &TestRequest{}
- fields := map[string]string {
- "Path": "path",
- "Query": "query",
- "Headers": "headers",
- "Method": "method",
- "Body": "body",
- "FormData": "form-data",
+ fields := map[string]string{
+ "Path": "path",
+ "Query": "query",
+ "Headers": "headers",
+ "Method": "method",
+ "Body": "body",
+ "FormData": "form-data",
"URLEncoded": "x-www-form-urlencoded",
- "Binary": "binary",
- "Json": "json",
- "Response": "response",
+ "Binary": "binary",
+ "Json": "json",
+ "Response": "response",
}
for g, j := range fields {
field, ok := reflect.TypeOf(fd).Elem().FieldByName(g)
-
+
if ok != true {
t.Errorf("failed to find field %s", g)
}
@@ -68,12 +68,12 @@
}
func TestRequestBuildBodyJsonTest(t *testing.T) {
- r := &TestRequest{}
+ r := &TestRequest{}
- j := map[string]interface{} {
+ j := map[string]interface{}{
"foo": 123,
"bar": true,
- "baz": map[string] interface{} {
+ "baz": map[string]interface{}{
"a": 789,
},
}
--- a/test_response.go Tue Jun 28 15:14:39 2016 -0500
+++ b/test_response.go Wed Jul 06 13:09:54 2016 -0500
@@ -1,9 +1,9 @@
package main
type TestResponse struct {
- StatusCode int `json:"statuscode"`
- Headers map[string]string `json:"headers"`
- Body string `json:"body"`
+ StatusCode int `json:"statuscode"`
+ Headers map[string]string `json:"headers"`
+ Body string `json:"body"`
JSONSchema map[string]interface{} `json:"json-schema"`
- File map[string]string `json:"file"`
+ File map[string]string `json:"file"`
}
--- a/test_response_test.go Tue Jun 28 15:14:39 2016 -0500
+++ b/test_response_test.go Wed Jul 06 13:09:54 2016 -0500
@@ -8,17 +8,17 @@
func TestResponseTagsTest(t *testing.T) {
fd := &TestResponse{}
- fields := map[string]string {
+ fields := map[string]string{
"StatusCode": "statuscode",
- "Headers": "headers",
- "Body": "body",
+ "Headers": "headers",
+ "Body": "body",
"JSONSchema": "json-schema",
- "File": "file",
+ "File": "file",
}
for g, j := range fields {
field, ok := reflect.TypeOf(fd).Elem().FieldByName(g)
-
+
if ok != true {
t.Errorf("failed to find field %s", g)
}
--- a/test_result.go Tue Jun 28 15:14:39 2016 -0500
+++ b/test_result.go Wed Jul 06 13:09:54 2016 -0500
@@ -1,12 +1,12 @@
package main
-import(
+import (
"net/http"
)
type TestResult struct {
- Test *Test
- Passed bool
+ Test *Test
+ Passed bool
HttpResponse http.Response
TestResponse TestResponse
}
--- a/test_result_test.go Tue Jun 28 15:14:39 2016 -0500
+++ b/test_result_test.go Wed Jul 06 13:09:54 2016 -0500
@@ -1,6 +1,6 @@
package main
-import(
+import (
"testing"
)