blob: 8ea076457ea88ddbdcf052a3d8e1161486d993cc [file] [log] [blame]
Sergiusz Bazanski4c0e9b52020-04-08 22:42:33 +02001package service
2
3import (
4 "context"
5 "testing"
6
7 pb "code.hackerspace.pl/hscloud/devtools/depotview/proto"
8)
9
10func TestIntegration(t *testing.T) {
11 // TODO(q3k); bring up fake git
12 s := New("https://gerrit.hackerspace.pl/hscloud")
13 ctx := context.Background()
14
15 res, err := s.Resolve(ctx, &pb.ResolveRequest{Ref: "master"})
16 if err != nil {
17 t.Fatalf("Resolve(master): %v", err)
18 }
19
20 if len(res.Hash) != 40 {
21 t.Fatalf("Resolve returned odd hash: %q", res.Hash)
22 }
23
24 res2, err := s.Stat(ctx, &pb.StatRequest{Hash: res.Hash, Path: "//WORKSPACE"})
25 if err != nil {
26 t.Fatalf("Stat(//WORKSPACE): %v", err)
27 }
28
29 if want, got := pb.StatResponse_TYPE_FILE, res2.Type; want != got {
30 t.Fatalf("Stat(//WORKSPACE): got %v, want %v", got, want)
31 }
32}