BlueGit

timfa bluegit

Files

bluegit / internal / sshd / parse_test.go

parse_test.go

feat: eerste basis van BlueGit
timfa project_87923614_bot_3aff574f6f98414b945a8799374f9092 · pushed by timfa · 3 weeks ago
151aa352 History
parse_test.go 667 B Download Raw
1package sshd
2
3import "testing"
4
5func TestParseGitCommand(t *testing.T) {
6 svc, repo, err := parseCommand("git-upload-pack 'tim/bluegit.git'")
7 if err != nil || svc != "upload-pack" || repo != "tim/bluegit.git" {
8 t.Fatalf("%s %s %v", svc, repo, err)
9 }
10 svc, repo, err = parseCommand(`git-receive-pack "/groep/site.git"`)
11 if err != nil || svc != "receive-pack" || repo != "groep/site.git" {
12 t.Fatalf("%s %s %v", svc, repo, err)
13 }
14 owner, name, ok := splitRepo("/tim/bluegit.git")
15 if !ok || owner != "tim" || name != "bluegit" {
16 t.Fatalf("%s %s %v", owner, name, ok)
17 }
18 if _, _, err := parseCommand("ls"); err == nil {
19 t.Fatal("shell hoort geweigerd")
20 }
21}