Debian Codegraph @

internal/command/fetch_test.go

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 package command
2
3 import (
4 "testing"
5
6 "github.com/isacikgoz/gitbatch/internal/git"
7 "github.com/stretchr/testify/require"
8 )
9
10 var (
11 testFetchopts1 = &FetchOptions{
12 RemoteName: "origin",
13 }
14
15 testFetchopts2 = &FetchOptions{
16 RemoteName: "origin",
17 Prune: true,
18 }
19
20 testFetchopts3 = &FetchOptions{
21 RemoteName: "origin",
22 DryRun: true,
23 }
24
25 testFetchopts4 = &FetchOptions{
26 RemoteName: "origin",
27 Progress: true,
28 }
29 )
30
31 func TestFetchWithGit(t *testing.T) {
•32 // Test requires internet access
33 t.Skip()
34 th := git.InitTestRepositoryFromLocal(t)
35 defer th.CleanUp(t)
36
37 var tests = []struct {
38 inp1 *git.Repository
39 inp2 *FetchOptions
40 }{
41 {th.Repository, testFetchopts1},
42 {th.Repository, testFetchopts2},
43 {th.Repository, testFetchopts3},
44 }
45 for _, test := range tests {
46 err := fetchWithGit(test.inp1, test.inp2)
47 require.NoError(t, err)
48 }
49 }
50
51 func TestFetchWithGoGit(t *testing.T) {
•52 // Test requires internet access
53 t.Skip()
54 th := git.InitTestRepositoryFromLocal(t)
55 defer th.CleanUp(t)
56
57 refspec := "+" + "refs/heads/" + th.Repository.State.Branch.Name + ":" + "/refs/remotes/" + th.Repository.State.Branch.Name
58 var tests = []struct {
59 inp1 *git.Repository
60 inp2 *FetchOptions
61 inp3 string
62 }{
63 {th.Repository, testFetchopts1, refspec},
64 {th.Repository, testFetchopts4, refspec},
65 }
66 for _, test := range tests {
67 err := fetchWithGoGit(test.inp1, test.inp2, test.inp3)
68 require.NoError(t, err)
69 }
70 }