@@ -19,81 +19,6 @@ import (
19
19
"github.com/circleci/ex/testing/testcontext"
20
20
)
21
21
22
- func TestHandler_WithBody (t * testing.T ) {
23
- ctx := testcontext .Background ()
24
-
25
- t .Run ("Test success" , func (t * testing.T ) {
26
- fix := startAPI (ctx , t )
27
-
28
- t .Run ("Can get a release" , func (t * testing.T ) {
29
- agent , err := fix .DownloadWithBody (ctx , release.Requirements {
30
- Platform : "linux" ,
31
- Arch : "amd64" ,
32
- })
33
-
34
- assert .Assert (t , err )
35
- assert .Check (t , cmp .DeepEqual (agent , & release.Release {
36
- URL : fix .S3URL + "/1.1.1-abcdef01/linux/amd64/circleci-agent" ,
37
- Checksum : "4a62f09b64873a20386cdbfaca87cc10d8352fab014ef0018f1abcce08a3d027" ,
38
- Version : "1.1.1-abcdef01" ,
39
- }))
40
- })
41
- })
42
-
43
- t .Run ("Test for unknown arch" , func (t * testing.T ) {
44
- fix := startAPI (ctx , t )
45
-
46
- t .Run ("Release not found" , func (t * testing.T ) {
47
- _ , err := fix .DownloadWithBody (ctx , release.Requirements {
48
- Platform : "linux" ,
49
- Arch : "enemy" ,
50
- })
51
- assert .Check (t , httpclient .HasStatusCode (err , http .StatusNotFound ))
52
- assert .Check (t , cmp .ErrorContains (err ,
53
- `404 (Not Found) (1 attempts): no download found for version="1.1.1-abcdef01" os="linux" arch="enemy"` ,
54
- ))
55
- })
56
- })
57
-
58
- t .Run ("Test invalid requests" , func (t * testing.T ) {
59
- fix := startAPI (ctx , t )
60
-
61
- t .Run ("No platform" , func (t * testing.T ) {
62
- _ , err := fix .DownloadWithBody (ctx , release.Requirements {
63
- Arch : "enemy" ,
64
- })
65
- assert .Check (t , httpclient .HasStatusCode (err , http .StatusBadRequest ))
66
- assert .Check (t , cmp .ErrorContains (err ,
67
- `400 (Bad Request) (1 attempts): bad request: platform is required` ,
68
- ))
69
- })
70
- t .Run ("No arch" , func (t * testing.T ) {
71
- _ , err := fix .DownloadWithBody (ctx , release.Requirements {
72
- Platform : "linux" ,
73
- })
74
- assert .Check (t , httpclient .HasStatusCode (err , http .StatusBadRequest ))
75
- assert .Check (t , cmp .ErrorContains (err ,
76
- `400 (Bad Request) (1 attempts): bad request: arch is required` ,
77
- ))
78
- })
79
- })
80
-
81
- t .Run ("Test no downloads" , func (t * testing.T ) {
82
- fix := startAPIWithDownloads (ctx , t , false )
83
-
84
- t .Run ("Should give 410" , func (t * testing.T ) {
85
- _ , err := fix .DownloadWithBody (ctx , release.Requirements {
86
- Platform : "linux" ,
87
- Arch : "amd64" ,
88
- })
89
- assert .Check (t , httpclient .HasStatusCode (err , http .StatusGone ))
90
- assert .Check (t , cmp .ErrorContains (err ,
91
- `410 (Gone) (1 attempts): no more downloads possible` ,
92
- ))
93
- })
94
- })
95
- }
96
-
97
22
func TestHandler_WithQuery (t * testing.T ) {
98
23
ctx := testcontext .Background ()
99
24
@@ -169,10 +94,6 @@ func TestHandler_WithQuery(t *testing.T) {
169
94
})
170
95
}
171
96
172
- func (f * fixture ) DownloadWithBody (ctx context.Context , requirements release.Requirements ) (* release.Release , error ) {
173
- return f .download (ctx , httpclient .Body (requirements ), httpclient .AllowGETWithBody ())
174
- }
175
-
176
97
func (f * fixture ) DownloadWithQuery (ctx context.Context , requirements release.Requirements ) (* release.Release , error ) {
177
98
return f .download (ctx , httpclient .QueryParams (map [string ]string {
178
99
"arch" : requirements .Arch ,
0 commit comments