File view with blame information shown in the left gutter beside each line.

barerepo / server / e2e/absent_test.go
44 lines · 1.5kb · 133728eaa05486504991b230f9d4c7e986b7defc
log files threads runs releases config jump to file t
133728e barerepo 1mo
1
package e2e
133728e barerepo 1mo
2
133728e barerepo 1mo
3
import (
133728e barerepo 1mo
4
"net/http"
133728e barerepo 1mo
5
"os/exec"
133728e barerepo 1mo
6
"strings"
133728e barerepo 1mo
7
"testing"
133728e barerepo 1mo
8
)
133728e barerepo 1mo
9
133728e barerepo 1mo
10
// Chapter 24 lists the pages that do not exist, and the whole argument is that they never appear.
133728e barerepo 1mo
11
func TestThePagesChapter24RefusesDoNotExist(t *testing.T) {
133728e barerepo 1mo
12
if _, err := exec.LookPath("git"); err != nil {
133728e barerepo 1mo
13
t.Skip("git is not installed")
133728e barerepo 1mo
14
}
133728e barerepo 1mo
15
in := newInstance(t)
133728e barerepo 1mo
16
john := in.account("john")
133728e barerepo 1mo
17
seed(t, in, john, "john", "johnbot")
133728e barerepo 1mo
18
133728e barerepo 1mo
19
// The discovery pages are absent per rule 7, and the rest per chapter 1.
133728e barerepo 1mo
20
absent := []string{
133728e barerepo 1mo
21
"/explore", "/trending", "/stars", "/followers", "/notifications",
133728e barerepo 1mo
22
"/wiki", "/boards", "/insights", "/marketplace", "/gists",
133728e barerepo 1mo
23
"/organizations", "/tour", "/edit",
133728e barerepo 1mo
24
"/john/johnbot/wiki", "/john/johnbot/insights", "/john/johnbot/stars",
133728e barerepo 1mo
25
"/john/johnbot/settings", "/john/johnbot/branches/protect", "/john/johnbot/merge-queue",
133728e barerepo 1mo
26
}
133728e barerepo 1mo
27
for _, path := range absent {
133728e barerepo 1mo
28
code, _, _ := get(t, in.http.URL+path)
133728e barerepo 1mo
29
if code != http.StatusNotFound {
133728e barerepo 1mo
30
t.Errorf("%s answered %d, and chapter 24 says it does not exist", path, code)
133728e barerepo 1mo
31
}
133728e barerepo 1mo
32
}
133728e barerepo 1mo
33
133728e barerepo 1mo
34
// And the one BUILD.md names as a trap, because every request for it is a request to be GitHub.
133728e barerepo 1mo
35
code, _, page := get(t, in.http.URL+"/john/johnbot/threads")
133728e barerepo 1mo
36
if code != http.StatusOK {
133728e barerepo 1mo
37
t.Fatalf("the threads page answered %d", code)
133728e barerepo 1mo
38
}
133728e barerepo 1mo
39
for _, button := range []string{">merge<", "merge pull", "squash and merge", "rebase and merge"} {
133728e barerepo 1mo
40
if strings.Contains(strings.ToLower(page), button) {
133728e barerepo 1mo
41
t.Errorf("the thread list offers %q, and BUILD.md says the answer is a fetch command", button)
133728e barerepo 1mo
42
}
133728e barerepo 1mo
43
}
133728e barerepo 1mo
44
}
history · rawbarerepo 0.1.0