| @@ -11,7 +11,9 @@ func TestOwnerProfiles(t *testing.T) { |
| 11 | 11 | inst := startInstance(t) |
| 12 | 12 | aliceKey := inst.newKey(t, "alice") |
| 13 | 13 | bobKey := inst.newKey(t, "bob") |
| 14 | | inst.admin(t, "admin", "user", "create", "alice", "--key", aliceKey+".pub") |
| 14 | // A verified address, because the about text is a commit now. |
| 15 | inst.admin(t, "admin", "user", "create", "alice", |
| 16 | "--key", aliceKey+".pub", "--email", "alice@example.test", "--verified") |
| 15 | 17 | inst.admin(t, "admin", "user", "create", "bob", "--key", bobKey+".pub") |
| 16 | 18 | |
| 17 | 19 | // Self-service user profile; website validated. |
| @@ -136,30 +138,22 @@ func TestOwnerProfiles(t *testing.T) { |
| 136 | 138 | t.Fatalf("org profile show: %s", out) |
| 137 | 139 | } |
| 138 | 140 | |
| 139 | | // About: long-form markdown, set inline or piped, rendered on the page. |
| 140 | | if _, errOut, code := inst.ssh(t, aliceKey, "# Hello\n\nI maintain *small tools*.\n", |
| 141 | | "profile", "set", "--file", "-"); code != 0 { |
| 142 | | t.Fatalf("about from stdin: %s", errOut) |
| 143 | | } |
| 144 | | out, _, _ = inst.ssh(t, aliceKey, "", "profile", "show", "alice", "--json") |
| 145 | | if !strings.Contains(out, "I maintain *small tools*.") { |
| 146 | | t.Fatalf("about not stored: %s", out) |
| 141 | // About: a file in <owner>/.gitbay, rendered on the page. The |
| 142 | // extension picks the renderer; there is no stored format. |
| 143 | if _, errOut, code := inst.ssh(t, aliceKey, "", "repo", "create", "alice/.gitbay"); code != 0 { |
| 144 | t.Fatalf("creating alice/.gitbay: %s", errOut) |
| 147 | 145 | } |
| 148 | | if !strings.Contains(out, "tinkerer") { |
| 149 | | t.Fatalf("about clobbered the description: %s", out) |
| 150 | | } |
| 151 | | |
| 152 | | // Org-mode about: the stored format picks the renderer. |
| 153 | 146 | if _, errOut, code := inst.ssh(t, aliceKey, "* Tools\n\nI maintain /small tools/.\n", |
| 154 | | "profile", "set", "--file", "-", "--about-format", "org"); code != 0 { |
| 147 | "repo", "commit-file", "alice/.gitbay", "profile/README.org", |
| 148 | "--ref", "main", "--file", "-"); code != 0 { |
| 155 | 149 | t.Fatalf("org about: %s", errOut) |
| 156 | 150 | } |
| 157 | 151 | out, _, _ = inst.ssh(t, aliceKey, "", "profile", "show", "alice", "--json") |
| 158 | 152 | if !strings.Contains(out, `"about_format":"org"`) { |
| 159 | | t.Fatalf("about format not stored: %s", out) |
| 153 | t.Fatalf("about format not read from the extension: %s", out) |
| 160 | 154 | } |
| 161 | | if _, _, code := inst.ssh(t, aliceKey, "", "profile", "set", "--about-format", "rst"); code != 2 { |
| 162 | | t.Fatal("unknown about format accepted") |
| 155 | if !strings.Contains(out, "tinkerer") { |
| 156 | t.Fatalf("about clobbered the description: %s", out) |
| 163 | 157 | } |
| 164 | 158 | // Org emphasis parsed, not left as literal slashes the way the |
| 165 | 159 | // markdown renderer would. |
| @@ -168,10 +162,15 @@ func TestOwnerProfiles(t *testing.T) { |
| 168 | 162 | t.Fatalf("org about not rendered as org: %s", body) |
| 169 | 163 | } |
| 170 | 164 | |
| 171 | | // Back to markdown for the rest of the checks. |
| 172 | | if _, _, code := inst.ssh(t, aliceKey, "# Hello\n\nI maintain *small tools*.\n", |
| 173 | | "profile", "set", "--file", "-", "--about-format", "md"); code != 0 { |
| 174 | | t.Fatal("markdown about") |
| 165 | // Markdown for the rest of the checks: .md wins the resolution order. |
| 166 | if _, errOut, code := inst.ssh(t, aliceKey, "# Hello\n\nI maintain *small tools*.\n", |
| 167 | "repo", "commit-file", "alice/.gitbay", "profile/README.md", |
| 168 | "--ref", "main", "--file", "-"); code != 0 { |
| 169 | t.Fatalf("markdown about: %s", errOut) |
| 170 | } |
| 171 | out, _, _ = inst.ssh(t, aliceKey, "", "profile", "show", "alice", "--json") |
| 172 | if !strings.Contains(out, "I maintain *small tools*.") { |
| 173 | t.Fatalf("about not read from the repository: %s", out) |
| 175 | 174 | } |
| 176 | 175 | |
| 177 | 176 | // Links: free-form, labelled or bare, capped, cleared by an empty one. |
| @@ -218,16 +217,14 @@ func TestOwnerProfiles(t *testing.T) { |
| 218 | 217 | t.Error("repositories render above the activity graph") |
| 219 | 218 | } |
| 220 | 219 | |
| 221 | | // Clearing works the same way as the other fields. |
| 220 | // Clearing works the same way as the other fields. The about is not |
| 221 | // among them: it is a file, and it goes the way a file goes. |
| 222 | 222 | if _, _, code := inst.ssh(t, aliceKey, "", "profile", "set", "--link", "''"); code != 0 { |
| 223 | 223 | t.Fatal("clear links failed") |
| 224 | 224 | } |
| 225 | | if _, _, code := inst.ssh(t, aliceKey, "", "profile", "set", "--about", "''"); code != 0 { |
| 226 | | t.Fatal("clear about failed") |
| 227 | | } |
| 228 | 225 | out, _, _ = inst.ssh(t, aliceKey, "", "profile", "show", "alice", "--json") |
| 229 | | if strings.Contains(out, "fosstodon") || strings.Contains(out, "small tools") { |
| 230 | | t.Fatalf("about or links not cleared: %s", out) |
| 226 | if strings.Contains(out, "fosstodon") { |
| 227 | t.Fatalf("links not cleared: %s", out) |
| 231 | 228 | } |
| 232 | 229 | status, body = inst.get(t, "/workshop") |
| 233 | 230 | if status != 200 || !strings.Contains(body, "where things get made") || |