| 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 |
testPullopts1 = &PullOptions{ |
| 12 |
RemoteName: "origin", |
| 13 |
} |
| 14 |
|
| 15 |
testPullopts2 = &PullOptions{ |
| 16 |
RemoteName: "origin", |
| 17 |
Force: true, |
| 18 |
} |
| 19 |
|
| 20 |
testPullopts3 = &PullOptions{ |
| 21 |
RemoteName: "origin", |
| 22 |
Progress: true, |
| 23 |
} |
| 24 |
) |
| 25 |
|
| 26 |
func TestPullWithGit(t *testing.T) { |
| •27 |
// Test requires internet access |
| 28 |
t.Skip() |
| 29 |
th := git.InitTestRepositoryFromLocal(t) |
| 30 |
defer th.CleanUp(t) |
| 31 |
|
| 32 |
var tests = []struct { |
| 33 |
inp1 *git.Repository |
| 34 |
inp2 *PullOptions |
| 35 |
}{ |
| 36 |
{th.Repository, testPullopts1}, |
| 37 |
{th.Repository, testPullopts2}, |
| 38 |
} |
| 39 |
for _, test := range tests { |
| 40 |
err := pullWithGit(test.inp1, test.inp2) |
| 41 |
require.NoError(t, err) |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
func TestPullWithGoGit(t *testing.T) { |
| •46 |
// Test requires internet access |
| 47 |
t.Skip() |
| 48 |
th := git.InitTestRepositoryFromLocal(t) |
| 49 |
defer th.CleanUp(t) |
| 50 |
|
| 51 |
var tests = []struct { |
| 52 |
inp1 *git.Repository |
| 53 |
inp2 *PullOptions |
| 54 |
}{ |
| 55 |
{th.Repository, testPullopts1}, |
| 56 |
{th.Repository, testPullopts3}, |
| 57 |
} |
| 58 |
for _, test := range tests { |
| 59 |
err := pullWithGoGit(test.inp1, test.inp2) |
| 60 |
require.NoError(t, err) |
| 61 |
} |
| 62 |
} |