mirror of https://github.com/statping/statping
api postman testing - API updates
parent
faad811f77
commit
ba8ec3f455
4
Makefile
4
Makefile
|
@ -85,6 +85,10 @@ test: clean compile install build-plugin
|
||||||
STATUP_DIR=$(TEST_DIR) go test -v -p=1 $(BUILDVERSION) -coverprofile=coverage.out ./...
|
STATUP_DIR=$(TEST_DIR) go test -v -p=1 $(BUILDVERSION) -coverprofile=coverage.out ./...
|
||||||
gocov convert coverage.out > coverage.json
|
gocov convert coverage.out > coverage.json
|
||||||
|
|
||||||
|
test-api:
|
||||||
|
DB_CONN=sqlite statup &
|
||||||
|
sleep 15 && newman run source/tmpl/postman.json -e dev/postman_environment.json
|
||||||
|
|
||||||
# report coverage to Coveralls
|
# report coverage to Coveralls
|
||||||
coverage:
|
coverage:
|
||||||
$(GOPATH)/bin/goveralls -coverprofile=coverage.out -service=travis -repotoken $(COVERALLS)
|
$(GOPATH)/bin/goveralls -coverprofile=coverage.out -service=travis -repotoken $(COVERALLS)
|
||||||
|
|
|
@ -55,17 +55,19 @@ func LoadUsingEnv() (*DbConfig, error) {
|
||||||
if os.Getenv("DB_CONN") == "" {
|
if os.Getenv("DB_CONN") == "" {
|
||||||
return nil, errors.New("Missing DB_CONN environment variable")
|
return nil, errors.New("Missing DB_CONN environment variable")
|
||||||
}
|
}
|
||||||
if os.Getenv("DB_HOST") == "" {
|
if os.Getenv("DB_CONN") != "sqlite" {
|
||||||
return nil, errors.New("Missing DB_HOST environment variable")
|
if os.Getenv("DB_HOST") == "" {
|
||||||
}
|
return nil, errors.New("Missing DB_HOST environment variable")
|
||||||
if os.Getenv("DB_USER") == "" {
|
}
|
||||||
return nil, errors.New("Missing DB_USER environment variable")
|
if os.Getenv("DB_USER") == "" {
|
||||||
}
|
return nil, errors.New("Missing DB_USER environment variable")
|
||||||
if os.Getenv("DB_PASS") == "" {
|
}
|
||||||
return nil, errors.New("Missing DB_PASS environment variable")
|
if os.Getenv("DB_PASS") == "" {
|
||||||
}
|
return nil, errors.New("Missing DB_PASS environment variable")
|
||||||
if os.Getenv("DB_DATABASE") == "" {
|
}
|
||||||
return nil, errors.New("Missing DB_DATABASE environment variable")
|
if os.Getenv("DB_DATABASE") == "" {
|
||||||
|
return nil, errors.New("Missing DB_DATABASE environment variable")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Configs = EnvToConfig()
|
Configs = EnvToConfig()
|
||||||
CoreApp.Name = os.Getenv("NAME")
|
CoreApp.Name = os.Getenv("NAME")
|
||||||
|
|
|
@ -79,6 +79,7 @@ type NotificationForm struct {
|
||||||
DbField string `json:"field"` // true variable key for input
|
DbField string `json:"field"` // true variable key for input
|
||||||
SmallText string `json:"small_text"` // insert small text under a html input
|
SmallText string `json:"small_text"` // insert small text under a html input
|
||||||
Required bool `json:"required"` // require this input on the html form
|
Required bool `json:"required"` // require this input on the html form
|
||||||
|
Hidden bool `json:"hidden"` // hide this form element from end user
|
||||||
}
|
}
|
||||||
|
|
||||||
// NotificationLog contains the normalized message from previously sent notifications
|
// NotificationLog contains the normalized message from previously sent notifications
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
|
|
||||||
{{range $n.Form}}
|
{{range $n.Form}}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="text-capitalize" for="{{underscore .Title}}">{{.Title}}</label>
|
<label class="text-capitalize{{if .Hidden}} d-none{{end}}" for="{{underscore .Title}}">{{.Title}}</label>
|
||||||
{{if eq .Type "textarea"}}
|
{{if eq .Type "textarea"}}
|
||||||
<textarea rows="3" class="form-control" name="{{underscore .DbField}}" id="{{underscore .Title}}">{{ $n.GetValue .DbField }}</textarea>
|
<textarea rows="3" class="form-control{{if .Hidden}} d-none{{end}}" name="{{underscore .DbField}}" id="{{underscore .Title}}">{{ $n.GetValue .DbField }}</textarea>
|
||||||
{{else}}
|
{{else}}
|
||||||
<input type="{{.Type}}" name="{{underscore .DbField}}" class="form-control" value="{{ $n.GetValue .DbField }}" id="{{underscore .Title}}" placeholder="{{.Placeholder}}" {{if .Required}}required{{end}}>
|
<input type="{{.Type}}" name="{{underscore .DbField}}" class="form-control{{if .Hidden}} d-none{{end}}" value="{{ $n.GetValue .DbField }}" id="{{underscore .Title}}" placeholder="{{.Placeholder}}" {{if .Required}}required{{end}}>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if .SmallText}}
|
{{if .SmallText}}
|
||||||
<small class="form-text text-muted">{{safe .SmallText}}</small>
|
<small class="form-text text-muted{{if .Hidden}} d-none{{end}}">{{safe .SmallText}}</small>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
Loading…
Reference in New Issue