1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-05 05:25:27 +02:00

Merge branch 'master' into reinstate-offline-mode

This commit is contained in:
Elliott Stoneham 2016-07-18 18:09:38 +01:00
commit 4813b6c23e
4 changed files with 11 additions and 94 deletions

View file

@ -75,10 +75,6 @@ func validateToken(ptoken string) error {
return err
}
func secretsJSON(token string) string {
return `{"token":"` + strings.TrimSpace(token) + `"}`
}
// Command to run the various functions required...
func (p *Provider) Command(ctx *provider.Context, w http.ResponseWriter, r *http.Request) {
query := r.URL.Query()

View file

@ -27,18 +27,18 @@ func init() {
}
// Command is an end-point...
func (ts *testsection) Command(w http.ResponseWriter, r *http.Request) {}
func (ts *testsection) Command(ctx *provider.Context, w http.ResponseWriter, r *http.Request) {}
var didRefresh bool
// Refresh existing data, returning data in the format of the target system
func (ts *testsection) Refresh(meta, data string) string {
func (ts *testsection) Refresh(ctx *provider.Context, meta, data string) string {
didRefresh = true
return ""
}
// Render converts data in the target system format into HTML
func (*testsection) Render(meta, data string) string {
func (*testsection) Render(ctx *provider.Context, meta, data string) string {
return "testsection " + data
}
@ -54,13 +54,15 @@ func (*testsection) Meta() provider.TypeMeta {
}
func TestSection(t *testing.T) {
if _, ok := provider.Refresh("testsection", "", ""); !ok {
ctx := provider.NewContext("_orgid_", "_userid_")
if _, ok := provider.Refresh("testsection", ctx, "", ""); !ok {
t.Error("did not find 'testsection' smart section (1)")
}
if !didRefresh {
t.Error("did not run the test Refresh method")
}
out, ok := provider.Render("testsection", "meta", "dingbat")
out, ok := provider.Render("testsection", ctx, "meta", "dingbat")
if !ok {
t.Error("did not find 'testsection' smart section (2)")
}