(t *testing.T)
| 35 | } |
| 36 | |
| 37 | func TestGetRawContent(t *testing.T) { |
| 38 | base, _ := url.Parse("https://raw.example.com/") |
| 39 | |
| 40 | tests := []struct { |
| 41 | name string |
| 42 | opts *ContentOpts |
| 43 | owner, repo, path string |
| 44 | statusCode int |
| 45 | contentType string |
| 46 | body string |
| 47 | expectError string |
| 48 | }{ |
| 49 | { |
| 50 | name: "HEAD fetch success", |
| 51 | opts: nil, |
| 52 | owner: "octocat", |
| 53 | repo: "hello", |
| 54 | path: "README.md", |
| 55 | statusCode: 200, |
| 56 | contentType: "text/plain", |
| 57 | body: "# Test file", |
| 58 | }, |
| 59 | { |
| 60 | name: "branch fetch success", |
| 61 | opts: &ContentOpts{Ref: "refs/heads/main"}, |
| 62 | owner: "octocat", |
| 63 | repo: "hello", |
| 64 | path: "README.md", |
| 65 | statusCode: 200, |
| 66 | contentType: "text/plain", |
| 67 | body: "# Test file", |
| 68 | }, |
| 69 | { |
| 70 | name: "tag fetch success", |
| 71 | opts: &ContentOpts{Ref: "refs/tags/v1.0.0"}, |
| 72 | owner: "octocat", |
| 73 | repo: "hello", |
| 74 | path: "README.md", |
| 75 | statusCode: 200, |
| 76 | contentType: "text/plain", |
| 77 | body: "# Test file", |
| 78 | }, |
| 79 | { |
| 80 | name: "sha fetch success", |
| 81 | opts: &ContentOpts{SHA: "abc123"}, |
| 82 | owner: "octocat", |
| 83 | repo: "hello", |
| 84 | path: "README.md", |
| 85 | statusCode: 200, |
| 86 | contentType: "text/plain", |
| 87 | body: "# Test file", |
| 88 | }, |
| 89 | { |
| 90 | name: "not found", |
| 91 | opts: nil, |
| 92 | owner: "octocat", |
| 93 | repo: "hello", |
| 94 | path: "notfound.txt", |
nothing calls this directly
no test coverage detected