api postman testing - API updates

pull/99/head
Hunter Long 2018-11-17 09:24:30 -08:00
parent faad811f77
commit ba8ec3f455
4 changed files with 22 additions and 15 deletions

View File

@ -85,6 +85,10 @@ test: clean compile install build-plugin
STATUP_DIR=$(TEST_DIR) go test -v -p=1 $(BUILDVERSION) -coverprofile=coverage.out ./...
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
coverage:
$(GOPATH)/bin/goveralls -coverprofile=coverage.out -service=travis -repotoken $(COVERALLS)

View File

@ -55,17 +55,19 @@ func LoadUsingEnv() (*DbConfig, error) {
if os.Getenv("DB_CONN") == "" {
return nil, errors.New("Missing DB_CONN 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_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_CONN") != "sqlite" {
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_PASS") == "" {
return nil, errors.New("Missing DB_PASS environment variable")
}
if os.Getenv("DB_DATABASE") == "" {
return nil, errors.New("Missing DB_DATABASE environment variable")
}
}
Configs = EnvToConfig()
CoreApp.Name = os.Getenv("NAME")

View File

@ -79,6 +79,7 @@ type NotificationForm struct {
DbField string `json:"field"` // true variable key for input
SmallText string `json:"small_text"` // insert small text under a html input
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

View File

@ -6,14 +6,14 @@
{{range $n.Form}}
<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"}}
<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}}
<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}}
{{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}}
</div>
{{end}}