|
|
|
@ -85,6 +85,10 @@ func Test_isGitRawOrLFSPath(t *testing.T) { |
|
|
|
|
"/owner/repo/releases/download/tag/repo.tar.gz", |
|
|
|
|
true, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"/owner/repo/attachments/6d92a9ee-5d8b-4993-97c9-6181bdaa8955", |
|
|
|
|
true, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
lfsTests := []string{ |
|
|
|
|
"/owner/repo/info/lfs/", |
|
|
|
@ -104,11 +108,11 @@ func Test_isGitRawOrLFSPath(t *testing.T) { |
|
|
|
|
t.Run(tt.path, func(t *testing.T) { |
|
|
|
|
req, _ := http.NewRequest("POST", "http://localhost"+tt.path, nil) |
|
|
|
|
setting.LFS.StartServer = false |
|
|
|
|
if got := isGitRawReleaseOrLFSPath(req); got != tt.want { |
|
|
|
|
if got := isGitRawOrAttachOrLFSPath(req); got != tt.want { |
|
|
|
|
t.Errorf("isGitOrLFSPath() = %v, want %v", got, tt.want) |
|
|
|
|
} |
|
|
|
|
setting.LFS.StartServer = true |
|
|
|
|
if got := isGitRawReleaseOrLFSPath(req); got != tt.want { |
|
|
|
|
if got := isGitRawOrAttachOrLFSPath(req); got != tt.want { |
|
|
|
|
t.Errorf("isGitOrLFSPath() = %v, want %v", got, tt.want) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
@ -117,11 +121,11 @@ func Test_isGitRawOrLFSPath(t *testing.T) { |
|
|
|
|
t.Run(tt, func(t *testing.T) { |
|
|
|
|
req, _ := http.NewRequest("POST", tt, nil) |
|
|
|
|
setting.LFS.StartServer = false |
|
|
|
|
if got := isGitRawReleaseOrLFSPath(req); got != setting.LFS.StartServer { |
|
|
|
|
t.Errorf("isGitOrLFSPath(%q) = %v, want %v, %v", tt, got, setting.LFS.StartServer, gitRawReleasePathRe.MatchString(tt)) |
|
|
|
|
if got := isGitRawOrAttachOrLFSPath(req); got != setting.LFS.StartServer { |
|
|
|
|
t.Errorf("isGitOrLFSPath(%q) = %v, want %v, %v", tt, got, setting.LFS.StartServer, gitRawOrAttachPathRe.MatchString(tt)) |
|
|
|
|
} |
|
|
|
|
setting.LFS.StartServer = true |
|
|
|
|
if got := isGitRawReleaseOrLFSPath(req); got != setting.LFS.StartServer { |
|
|
|
|
if got := isGitRawOrAttachOrLFSPath(req); got != setting.LFS.StartServer { |
|
|
|
|
t.Errorf("isGitOrLFSPath(%q) = %v, want %v", tt, got, setting.LFS.StartServer) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|