(t *testing.T)
| 21 | ) |
| 22 | |
| 23 | func TestGitlabImport(t *testing.T) { |
| 24 | envToken := os.Getenv("GITLAB_API_TOKEN") |
| 25 | if envToken == "" { |
| 26 | t.Skip("Env var GITLAB_API_TOKEN missing") |
| 27 | } |
| 28 | |
| 29 | projectID := os.Getenv("GITLAB_PROJECT_ID") |
| 30 | if projectID == "" { |
| 31 | t.Skip("Env var GITLAB_PROJECT_ID missing") |
| 32 | } |
| 33 | |
| 34 | repo := repository.CreateGoGitTestRepo(t, false) |
| 35 | |
| 36 | backend, err := cache.NewRepoCacheNoEvents(repo) |
| 37 | require.NoError(t, err) |
| 38 | |
| 39 | defer backend.Close() |
| 40 | interrupt.RegisterCleaner(backend.Close) |
| 41 | |
| 42 | author, err := identity.NewIdentity(repo, "Amine Hilaly", "hilalyamine@gmail.com") |
| 43 | require.NoError(t, err) |
| 44 | |
| 45 | tests := []struct { |
| 46 | name string |
| 47 | url string |
| 48 | bug *bug.Snapshot |
| 49 | }{ |
| 50 | { |
| 51 | name: "simple issue", |
| 52 | url: "https://gitlab.com/git-bug/test/-/issues/1", |
| 53 | bug: &bug.Snapshot{ |
| 54 | Operations: []dag.Operation{ |
| 55 | bug.NewCreateOp(author, 0, "simple issue", "initial comment", nil), |
| 56 | bug.NewAddCommentOp(author, 0, "first comment", nil), |
| 57 | bug.NewAddCommentOp(author, 0, "second comment", nil), |
| 58 | }, |
| 59 | }, |
| 60 | }, |
| 61 | { |
| 62 | name: "empty issue", |
| 63 | url: "https://gitlab.com/git-bug/test/-/issues/2", |
| 64 | bug: &bug.Snapshot{ |
| 65 | Operations: []dag.Operation{ |
| 66 | bug.NewCreateOp(author, 0, "empty issue", "", nil), |
| 67 | }, |
| 68 | }, |
| 69 | }, |
| 70 | { |
| 71 | name: "complex issue", |
| 72 | url: "https://gitlab.com/git-bug/test/-/issues/3", |
| 73 | bug: &bug.Snapshot{ |
| 74 | Operations: []dag.Operation{ |
| 75 | bug.NewCreateOp(author, 0, "complex issue", "initial comment", nil), |
| 76 | bug.NewAddCommentOp(author, 0, "### header\n\n**bold**\n\n_italic_\n\n> with quote\n\n`inline code`\n\n```\nmultiline code\n```\n\n- bulleted\n- list\n\n1. numbered\n1. list\n\n- [ ] task\n- [x] list\n\n@git-bug mention\n\n#2 reference issue\n#3 auto-reference issue", nil), |
| 77 | bug.NewSetTitleOp(author, 0, "complex issue edited", "complex issue"), |
| 78 | bug.NewSetTitleOp(author, 0, "complex issue", "complex issue edited"), |
| 79 | bug.NewSetStatusOp(author, 0, common.ClosedStatus), |
| 80 | bug.NewSetStatusOp(author, 0, common.OpenStatus), |
nothing calls this directly
no test coverage detected