Browse Source

Add additional tests to increase coverage (#29)

pull/31/head
Jonas Franz 3 years ago committed by Gitea
parent
commit
1ebad29137
  1. 2
      migrations/github_test.go
  2. 25
      migrations/repo_test.go

2
migrations/github_test.go

@ -49,7 +49,7 @@ func TestFetchMigratory_FetchIssues(t *testing.T) { @@ -49,7 +49,7 @@ func TestFetchMigratory_FetchIssues(t *testing.T) {
}
func TestFetchMigratory_FetchComments(t *testing.T) {
comments, err := testFMig.FetchIssues()
comments, err := testFMig.FetchComments()
assert.NoError(t, err)
assert.True(t, len(comments) > 0, "at least one comment found")
}

25
migrations/repo_test.go

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
package migrations
import (
"github.com/google/go-github/github"
"github.com/stretchr/testify/assert"
"testing"
)
func TestMigratory_Repository(t *testing.T) {
fm := &FetchMigratory{
Migratory: *DemoMigratory,
GHClient: github.NewClient(nil),
RepoOwner: "JonasFranzDEV",
RepoName: "migrate",
}
ghRepo, _, err := fm.GHClient.Repositories.Get(fm.ctx(), fm.RepoOwner, fm.RepoName)
if err != nil {
t.Skipf("Skipped due to repo is not accessable: %v", err)
return
}
repo, err := fm.Repository(ghRepo)
assertNoError(t, err)
assert.Equal(t, "migrate", repo.Name)
assertNoError(t, fm.Client.DeleteRepo("demo", "migrate"))
}
Loading…
Cancel
Save