| package service |
| |
| import ( |
| "context" |
| "testing" |
| |
| pb "code.hackerspace.pl/hscloud/devtools/depotview/proto" |
| ) |
| |
| func TestIntegration(t *testing.T) { |
| // TODO(q3k); bring up fake git |
| s := New("https://gerrit.hackerspace.pl/hscloud") |
| ctx := context.Background() |
| |
| res, err := s.Resolve(ctx, &pb.ResolveRequest{Ref: "master"}) |
| if err != nil { |
| t.Fatalf("Resolve(master): %v", err) |
| } |
| |
| if len(res.Hash) != 40 { |
| t.Fatalf("Resolve returned odd hash: %q", res.Hash) |
| } |
| |
| res2, err := s.Stat(ctx, &pb.StatRequest{Hash: res.Hash, Path: "//WORKSPACE"}) |
| if err != nil { |
| t.Fatalf("Stat(//WORKSPACE): %v", err) |
| } |
| |
| if want, got := pb.StatResponse_TYPE_FILE, res2.Type; want != got { |
| t.Fatalf("Stat(//WORKSPACE): got %v, want %v", got, want) |
| } |
| } |