|
3 | 3 |
|
4 | 4 | package request_test |
5 | 5 |
|
6 | | -import ( |
7 | | - "context" |
8 | | - "testing" |
| 6 | +// func TestParseReadmeFromLink(t *testing.T) { |
| 7 | +// testData := []struct { |
| 8 | +// name string |
| 9 | +// input string |
| 10 | +// expected link.Readme |
| 11 | +// }{ |
| 12 | +// { |
| 13 | +// name: "parse PR link", |
| 14 | +// input: "https://github.com/Azure/azure-rest-api-specs/pull/11377", |
| 15 | +// expected: "specification/security/resource-manager/readme.md", |
| 16 | +// }, |
| 17 | +// { |
| 18 | +// name: "parse github directory", |
| 19 | +// input: "https://github.com/Azure/azure-rest-api-specs/tree/636ade9c4b88ad7e408d85f564ddedbc638ae524/specification/monitor/resource-manager", |
| 20 | +// expected: "specification/monitor/resource-manager/readme.md", |
| 21 | +// }, |
| 22 | +// { |
| 23 | +// name: "parse github file", |
| 24 | +// input: "https://github.com/Azure/azure-rest-api-specs/blob/636ade9c4b88ad7e408d85f564ddedbc638ae524/specification/storage/resource-manager/readme.md", |
| 25 | +// expected: "specification/storage/resource-manager/readme.md", |
| 26 | +// }, |
| 27 | +// } |
9 | 28 |
|
10 | | - "github.com/Azure/azure-sdk-for-go/eng/tools/generator/cmd/issue/link" |
11 | | - "github.com/Azure/azure-sdk-for-go/eng/tools/generator/cmd/issue/query" |
12 | | - "github.com/Azure/azure-sdk-for-go/eng/tools/generator/cmd/issue/request" |
13 | | - "github.com/google/go-github/v62/github" |
14 | | -) |
15 | | - |
16 | | -func TestParseReadmeFromLink(t *testing.T) { |
17 | | - testData := []struct { |
18 | | - name string |
19 | | - input string |
20 | | - expected link.Readme |
21 | | - }{ |
22 | | - { |
23 | | - name: "parse PR link", |
24 | | - input: "https://github.com/Azure/azure-rest-api-specs/pull/11377", |
25 | | - expected: "specification/security/resource-manager/readme.md", |
26 | | - }, |
27 | | - { |
28 | | - name: "parse github directory", |
29 | | - input: "https://github.com/Azure/azure-rest-api-specs/tree/636ade9c4b88ad7e408d85f564ddedbc638ae524/specification/monitor/resource-manager", |
30 | | - expected: "specification/monitor/resource-manager/readme.md", |
31 | | - }, |
32 | | - { |
33 | | - name: "parse github file", |
34 | | - input: "https://github.com/Azure/azure-rest-api-specs/blob/636ade9c4b88ad7e408d85f564ddedbc638ae524/specification/storage/resource-manager/readme.md", |
35 | | - expected: "specification/storage/resource-manager/readme.md", |
36 | | - }, |
37 | | - } |
38 | | - |
39 | | - for _, c := range testData { |
40 | | - t.Logf("Testing %s...", c.name) |
41 | | - client := &query.Client{ |
42 | | - Client: github.NewClient(nil), |
43 | | - } |
44 | | - result, err := request.ParseReadmeFromLink(context.Background(), client, request.ReleaseRequestIssue{ |
45 | | - IssueLink: "", |
46 | | - TargetLink: c.input, |
47 | | - }) |
48 | | - if err != nil { |
49 | | - t.Fatalf("unexpected error: %+v", err) |
50 | | - } |
51 | | - if result.GetReadme() != c.expected { |
52 | | - t.Fatalf("expected %q but got %q", c.expected, result.GetReadme()) |
53 | | - } |
54 | | - } |
55 | | -} |
| 29 | +// for _, c := range testData { |
| 30 | +// t.Logf("Testing %s...", c.name) |
| 31 | +// client := &query.Client{ |
| 32 | +// Client: github.NewClient(nil), |
| 33 | +// } |
| 34 | +// result, err := request.ParseReadmeFromLink(context.Background(), client, request.ReleaseRequestIssue{ |
| 35 | +// IssueLink: "", |
| 36 | +// TargetLink: c.input, |
| 37 | +// }) |
| 38 | +// if err != nil { |
| 39 | +// t.Fatalf("unexpected error: %+v", err) |
| 40 | +// } |
| 41 | +// if result.GetReadme() != c.expected { |
| 42 | +// t.Fatalf("expected %q but got %q", c.expected, result.GetReadme()) |
| 43 | +// } |
| 44 | +// } |
| 45 | +// } |
0 commit comments