vole
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software:2222/vole.git
A free and open-source forge that lives in your Git repo.
Expand the admin status page into an operational dashboard
4506a4d3d279556435fdd414265e7499c3dada16 · Keenan Nemetz · 14d ago · parent 2e024cc9
server/home_test.go +14−3
| @@ -48,14 +48,14 @@ func TestHomeHasTheCleanTopBar(t *testing.T) { | |||
| 48 | 48 | ||
| 49 | 49 | _, body := f.get("/") | |
| 50 | 50 | for _, want := range []string{ | |
| 51 | `class="topbar"`, `class="topnav"`, `href="/runners"`, `href="/activity"`, | ||
| 51 | `class="topbar"`, `class="topnav"`, `href="/activity"`, | ||
| 52 | 52 | `class="topsearch"`, `name="q"`, `href="/login"`, | |
| 53 | 53 | } { | |
| 54 | 54 | if !strings.Contains(body, want) { | |
| 55 | 55 | t.Fatalf("home is missing the top-bar marker %q:\n%s", want, body) | |
| 56 | 56 | } | |
| 57 | 57 | } | |
| 58 | for _, unwanted := range []string{`class="rail"`, `src="/static/nav.js"`, `>Repositories</a>`} { | ||
| 58 | for _, unwanted := range []string{`class="rail"`, `src="/static/nav.js"`, `>Repositories</a>`, `href="/runners"`, `href="/status"`} { | ||
| 59 | 59 | if strings.Contains(body, unwanted) { | |
| 60 | 60 | t.Fatalf("home still has %q:\n%s", unwanted, body) | |
| 61 | 61 | } | |
| @@ -63,11 +63,22 @@ func TestHomeHasTheCleanTopBar(t *testing.T) { | |||
| 63 | 63 | ||
| 64 | 64 | _, cookie := f.browserSession(t, f.ownerID) | |
| 65 | 65 | _, body = f.browserGet(t, "/", cookie) | |
| 66 | for _, want := range []string{`class="account-menu"`, `class="account-pop"`, `href="/account"`, `href="/status"`, `action="/logout"`} { | ||
| 66 | for _, want := range []string{`class="account-menu"`, `class="account-pop"`, `href="/account"`, `action="/logout"`} { | ||
| 67 | 67 | if !strings.Contains(body, want) { | |
| 68 | 68 | t.Fatalf("signed-in top bar is missing %q:\n%s", want, body) | |
| 69 | 69 | } | |
| 70 | 70 | } | |
| 71 | if strings.Contains(body, `href="/status"`) { | ||
| 72 | t.Fatalf("non-admin sees the Status link:\n%s", body) | ||
| 73 | } | ||
| 74 | |||
| 75 | if _, err := f.srv.Identity.SetAdmin(f.ownerID, true, "test"); err != nil { | ||
| 76 | t.Fatal(err) | ||
| 77 | } | ||
| 78 | _, body = f.browserGet(t, "/", cookie) | ||
| 79 | if !strings.Contains(body, `href="/status"`) { | ||
| 80 | t.Fatalf("instance admin does not see the Status link:\n%s", body) | ||
| 81 | } | ||
| 71 | 82 | } | |
| 72 | 83 | ||
| 73 | 84 | func TestHomeSearchShowsProjectCards(t *testing.T) { | |