vole
Clone
Read only, no credentials:
https://rodent.software/git/vole.git
Write over SSH with a registered key:
git clone ssh://git@0.0.0.0:2222/vole.git
A free and open-source forge that lives in your Git repo.
|
bca9ec24
Keenan Nemetz
9d ago
|
1 | package server_test |
| 2 | ||
| 3 | // A release is a tag, so its feed event is not announced by a metadata commit. | |
| 4 | // Both paths that create a tag must refresh the feed: a push (post-receive) and | |
| 5 | // the browser's release form (which writes the tag on the server directly). | |
| 6 | ||
| 7 | import ( | |
| 8 | "net/url" | |
| 9 | "strings" | |
| 10 | "testing" | |
| 11 | ) | |
| 12 | ||
| 13 | func TestActivityShowsAReleasePushedAsATag(t *testing.T) { | |
| 14 | t.Parallel() | |
| 15 | f := newFixture(t) | |
| 16 | f.publish(f.repo) | |
| 17 | work := workRepo(t, map[string]string{"README.md": "# release\n"}) | |
| 18 | if _, errs, err := f.git(work, "push", f.sshURL(f.repo), "main:refs/heads/main"); err != nil { | |
| 19 | t.Fatalf("push main: %s", errs) | |
| 20 | } | |
| 21 | runGit(t, work, "tag", "-a", "v1.0.0", "-m", "first release\n") | |
| 22 | if _, errs, err := f.git(work, "push", f.sshURL(f.repo), "v1.0.0"); err != nil { | |
| 23 | t.Fatalf("push tag: %s", errs) | |
| 24 | } | |
| 25 | ||
|
ed03b3d1
Keenan Nemetz
2h ago
|
26 | _, body := f.get("/" + f.repo + "/activity") |
|
bca9ec24
Keenan Nemetz
9d ago
|
27 | if !strings.Contains(body, "released") || !strings.Contains(body, "v1.0.0") { |
| 28 | t.Fatalf("the pushed tag is not in the activity feed:\n%s", body) | |
| 29 | } | |
| 30 | } | |
| 31 | ||
| 32 | func TestActivityShowsAReleaseCreatedInTheBrowser(t *testing.T) { | |
| 33 | t.Parallel() | |
| 34 | f := newFixture(t) | |
| 35 | f.publish(f.repo) | |
| 36 | work := workRepo(t, map[string]string{"README.md": "# release\n"}) | |
| 37 | if _, errs, err := f.git(work, "push", f.sshURL(f.repo), "main:refs/heads/main"); err != nil { | |
| 38 | t.Fatalf("push main: %s", errs) | |
| 39 | } | |
| 40 | sess, cookie := f.browserSession(t, f.ownerID) | |
|
ed03b3d1
Keenan Nemetz
2h ago
|
41 | resp, body := f.browserPost(t, "/"+f.repo+"/releases", cookie, url.Values{ |
|
bca9ec24
Keenan Nemetz
9d ago
|
42 | "csrf": {sess.CSRF}, "tag": {"v2.0.0"}, "target": {"main"}, |
| 43 | "notes": {"second release\n"}, | |
| 44 | }) | |
| 45 | if resp.StatusCode != 303 { | |
| 46 | t.Fatalf("create release: %d\n%s", resp.StatusCode, body) | |
| 47 | } | |
| 48 | // The write refreshes the release events before it answers, so the feed is | |
| 49 | // current on the next read. | |
|
ed03b3d1
Keenan Nemetz
2h ago
|
50 | _, body = f.get("/" + f.repo + "/activity") |
|
bca9ec24
Keenan Nemetz
9d ago
|
51 | if !strings.Contains(body, "released") || !strings.Contains(body, "v2.0.0") { |
| 52 | t.Fatalf("the browser release is not in the activity feed:\n%s", body) | |
| 53 | } | |
| 54 | } |