(t *testing.T)
| 31 | } |
| 32 | |
| 33 | func TestStaticConfig(t *testing.T) { |
| 34 | ld := test.NewLoader() |
| 35 | h, err := newFromConfig(ld, jsonconfig.Obj{ |
| 36 | "dummy1": map[string]interface{}{ |
| 37 | "clientID": "id1", |
| 38 | "clientSecret": "secret1", |
| 39 | }, |
| 40 | "dummy2": map[string]interface{}{ |
| 41 | "clientSecret": "id2:secret2", |
| 42 | }, |
| 43 | }) |
| 44 | if err != nil { |
| 45 | t.Fatal(err) |
| 46 | } |
| 47 | host := h.(*Host) |
| 48 | if g, w := host.imp["dummy1"].clientID, "id1"; g != w { |
| 49 | t.Errorf("dummy1 id = %q; want %q", g, w) |
| 50 | } |
| 51 | if g, w := host.imp["dummy1"].clientSecret, "secret1"; g != w { |
| 52 | t.Errorf("dummy1 secret = %q; want %q", g, w) |
| 53 | } |
| 54 | if g, w := host.imp["dummy2"].clientID, "id2"; g != w { |
| 55 | t.Errorf("dummy2 id = %q; want %q", g, w) |
| 56 | } |
| 57 | if g, w := host.imp["dummy2"].clientSecret, "secret2"; g != w { |
| 58 | t.Errorf("dummy2 secret = %q; want %q", g, w) |
| 59 | } |
| 60 | |
| 61 | if _, err := newFromConfig(ld, jsonconfig.Obj{"dummy1": map[string]interface{}{"bogus": ""}}); err == nil { |
| 62 | t.Errorf("expected error from unknown key") |
| 63 | } |
| 64 | |
| 65 | if _, err := newFromConfig(ld, jsonconfig.Obj{"dummy1": map[string]interface{}{"clientSecret": "x"}}); err == nil { |
| 66 | t.Errorf("expected error from secret without id") |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | func TestImportRootPageHTML(t *testing.T) { |
| 71 | h, err := NewHost(HostConfig{}) |
nothing calls this directly
no test coverage detected