-
Notifications
You must be signed in to change notification settings - Fork 18
/
result.go
54 lines (43 loc) · 942 Bytes
/
result.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package cute
import (
"net/http"
)
// ResultState is state of test
type ResultState int
// ResultState is state of test
const (
ResultStateSuccess ResultState = iota
ResultStateBroken
ResultStateFail
// resultStateFailNow is state for require validations (execute failNow)
resultStateFailNow
)
type testResults struct {
name string
state ResultState
resp *http.Response
errors []error
}
func newTestResult(name string, resp *http.Response, state ResultState, errs []error) ResultsHTTPBuilder {
return &testResults{
name: name,
resp: resp,
state: state,
errors: errs,
}
}
func (r *testResults) GetHTTPResponse() *http.Response {
return r.resp
}
func (r *testResults) GetErrors() []error {
return r.errors
}
func (r *testResults) GetName() string {
return r.name
}
func (r *testResults) GetResultState() ResultState {
if r.state == resultStateFailNow {
return ResultStateFail
}
return r.state
}