aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/github/export_test.go
blob: c3a835b2bbe84ce937ab3c93356e447b756d76fa (plain) (blame)
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
63
64
65
66
67
68
69
70
71
72
package github

import (
	"fmt"
	"os"
	"testing"
	"time"

	"github.com/MichaelMure/git-bug/bridge/core"
	"github.com/MichaelMure/git-bug/cache"
	"github.com/MichaelMure/git-bug/repository"
	"github.com/MichaelMure/git-bug/util/interrupt"
	"github.com/stretchr/testify/require"
)

func TestExporter(t *testing.T) {
	//TODO test strategy
	tests := []struct {
		name string
	}{
		{
			name: "bug creation",
		},
	}

	repo := repository.CreateTestRepo(false)
	defer repository.CleanupTestRepos(t, repo)

	backend, err := cache.NewRepoCache(repo)
	require.NoError(t, err)

	defer backend.Close()
	interrupt.RegisterCleaner(backend.Close)

	token := os.Getenv("GITHUB_TOKEN_PRIVATE")
	if token == "" {
		t.Skip("Env var GITHUB_TOKEN_PRIVATE missing")
	}

	exporter := &githubExporter{}
	err = exporter.Init(core.Configuration{
		keyOwner:   "MichaelMure",
		keyProject: "git-bug-exporter-tests",
		keyToken:   token,
	})
	require.NoError(t, err)

	start := time.Now()

	err = exporter.ExportAll(backend, time.Time{})
	require.NoError(t, err)

	fmt.Printf("test repository exported in %f seconds\n", time.Since(start).Seconds())

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {

		})
	}
}

func genRepoName() {}

func createRepository() {}

func deleteRepository() {}

// verifyIssue is full
// comments
func verifyIssue() {

}