MCPcopy Index your code
hub / github.com/git-bug/git-bug / TestGithubImporter

Function TestGithubImporter

bridge/github/import_test.go:24–242  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22)
23
24func TestGithubImporter(t *testing.T) {
25 envToken := os.Getenv("GITHUB_TOKEN")
26 if envToken == "" {
27 t.Skip("missing required environment variable: GITHUB_TOKEN")
28 }
29
30 repo := repository.CreateGoGitTestRepo(t, false)
31
32 backend, err := cache.NewRepoCacheNoEvents(repo)
33 require.NoError(t, err)
34
35 defer backend.Close()
36 interrupt.RegisterCleaner(backend.Close)
37
38 author, err := identity.NewIdentity(repo, "Michael Muré", "no-reply@git-bug.test")
39 require.NoError(t, err)
40
41 complexIssueEditAuthor, err := identity.NewIdentity(repo, "sudoforge", "no-reply@git-bug.test")
42 require.NoError(t, err)
43
44 tests := []struct {
45 name string
46 url string
47 bug *bug.Snapshot
48 }{
49 {
50 name: "simple issue",
51 url: "https://github.com/git-bug/test-github-bridge/issues/1",
52 bug: &bug.Snapshot{
53 Operations: []dag.Operation{
54 bug.NewCreateOp(author, 0, "simple issue", "initial comment", nil),
55 bug.NewAddCommentOp(author, 0, "first comment", nil),
56 bug.NewAddCommentOp(author, 0, "second comment", nil),
57 },
58 },
59 },
60 {
61 name: "empty issue",
62 url: "https://github.com/git-bug/test-github-bridge/issues/2",
63 bug: &bug.Snapshot{
64 Operations: []dag.Operation{
65 bug.NewCreateOp(author, 0, "empty issue", "", nil),
66 },
67 },
68 },
69 {
70 name: "complex issue",
71 url: "https://github.com/git-bug/test-github-bridge/issues/3",
72 bug: &bug.Snapshot{
73 Operations: []dag.Operation{
74 bug.NewCreateOp(author, 0, "complex issue", "initial comment", nil),
75 bug.NewLabelChangeOperation(author, 0, []common.Label{"bug"}, []common.Label{}),
76 bug.NewLabelChangeOperation(author, 0, []common.Label{"duplicate"}, []common.Label{}),
77 bug.NewLabelChangeOperation(author, 0, []common.Label{}, []common.Label{"duplicate"}),
78 bug.NewAddCommentOp(author, 0, strings.Join([]string{
79 "### header",
80 "**bold**",
81 "_italic_",

Callers

nothing calls this directly

Calls 15

SetMetadataMethod · 0.95
InitMethod · 0.95
ImportAllMethod · 0.95
CreateGoGitTestRepoFunction · 0.92
NewRepoCacheNoEventsFunction · 0.92
RegisterCleanerFunction · 0.92
NewIdentityFunction · 0.92
NewCreateOpFunction · 0.92
NewAddCommentOpFunction · 0.92
NewLabelChangeOperationFunction · 0.92
NewEditCommentOpFunction · 0.92
NewSetTitleOpFunction · 0.92

Tested by

no test coverage detected