File: pull_test.go

package info (click to toggle)
gitbatch 0.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 644 kB
  • sloc: makefile: 5; sh: 1
file content (62 lines) | stat: -rw-r--r-- 1,138 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package command

import (
	"testing"

	"github.com/isacikgoz/gitbatch/internal/git"
	"github.com/stretchr/testify/require"
)

var (
	testPullopts1 = &PullOptions{
		RemoteName: "origin",
	}

	testPullopts2 = &PullOptions{
		RemoteName: "origin",
		Force:      true,
	}

	testPullopts3 = &PullOptions{
		RemoteName: "origin",
		Progress:   true,
	}
)

func TestPullWithGit(t *testing.T) {
	// Test requires internet access
	t.Skip()
	th := git.InitTestRepositoryFromLocal(t)
	defer th.CleanUp(t)

	var tests = []struct {
		inp1 *git.Repository
		inp2 *PullOptions
	}{
		{th.Repository, testPullopts1},
		{th.Repository, testPullopts2},
	}
	for _, test := range tests {
		err := pullWithGit(test.inp1, test.inp2)
		require.NoError(t, err)
	}
}

func TestPullWithGoGit(t *testing.T) {
	// Test requires internet access
	t.Skip()
	th := git.InitTestRepositoryFromLocal(t)
	defer th.CleanUp(t)

	var tests = []struct {
		inp1 *git.Repository
		inp2 *PullOptions
	}{
		{th.Repository, testPullopts1},
		{th.Repository, testPullopts3},
	}
	for _, test := range tests {
		err := pullWithGoGit(test.inp1, test.inp2)
		require.NoError(t, err)
	}
}