@@ -84,28 +84,32 @@ func TestBuildsCreate(t *testing.T) {
8484
8585 server .Mux .HandleFunc ("/v2/apps/enterprise/build/" , func (w http.ResponseWriter , r * http.Request ) {
8686 testutil .SetHeaders (w )
87- testutil .AssertBody (t , api.CreateBuildRequest {
88- Image : "ncc/1701:A" ,
89- Stack : "container" ,
90- }, r )
91- w .WriteHeader (http .StatusCreated )
92- fmt .Fprintf (w , "{}" )
87+ if r .Method == "POST" {
88+ testutil .AssertBody (t , api.CreateBuildRequest {
89+ Image : "ncc/1701:A" ,
90+ Stack : "container" ,
91+ }, r )
92+ w .WriteHeader (http .StatusCreated )
93+ fmt .Fprintf (w , "{}" )
94+ }
9395 })
9496
95- err = cmdr .BuildsCreate ("enterprise" , "ncc/1701:A" , "container" , "" , "" )
97+ err = cmdr .BuildsCreate ("enterprise" , "ncc/1701:A" , "container" , "" , "" , "yes" )
9698 assert .NoError (t , err )
9799 assert .Equal (t , testutil .StripProgress (b .String ()), "Creating build... done\n " , "output" )
98100
99101 server .Mux .HandleFunc ("/v2/apps/bradbury/build/" , func (w http.ResponseWriter , r * http.Request ) {
100102 testutil .SetHeaders (w )
101- testutil .AssertBody (t , api.CreateBuildRequest {
102- Image : "nx/72307:latest" ,
103- Stack : "container" ,
104- Procfile : map [string ]string {
105- "web" : "./drive" ,
106- "warp" : "./warp 8" ,
107- },
108- }, r )
103+ if r .Method == "POST" {
104+ testutil .AssertBody (t , api.CreateBuildRequest {
105+ Image : "nx/72307:latest" ,
106+ Stack : "container" ,
107+ Procfile : map [string ]string {
108+ "web" : "./drive" ,
109+ "warp" : "./warp 8" ,
110+ },
111+ }, r )
112+ }
109113
110114 w .WriteHeader (http .StatusCreated )
111115 fmt .Fprintf (w , "{}" )
@@ -127,28 +131,30 @@ warp: ./warp 8`
127131 }
128132 }()
129133
130- err = cmdr .BuildsCreate ("bradbury" , "nx/72307:latest" , "container" , tmpDir + "/Procfile" , "" )
134+ err = cmdr .BuildsCreate ("bradbury" , "nx/72307:latest" , "container" , tmpDir + "/Procfile" , "" , "yes" )
131135 assert .NoError (t , err )
132136 assert .Equal (t , testutil .StripProgress (b .String ()), "Creating build... done\n " , "output" )
133137
134138 server .Mux .HandleFunc ("/v2/apps/franklin/build/" , func (w http.ResponseWriter , r * http.Request ) {
135139 testutil .SetHeaders (w )
136- testutil .AssertBody (t , api.CreateBuildRequest {
137- Image : "nx/326:latest" ,
138- Stack : "container" ,
139- Procfile : map [string ]string {
140- "web" : "./drive" ,
141- "warp" : "./warp 8" ,
142- },
143- Dryccfile : map [string ]interface {}{
144- "deploy" : map [string ]interface {}{
145- "web" : map [string ]interface {}{
146- "command" : []string {"bash" , "-c" },
147- "args" : []string {"bundle exec puma -C config/puma.rb" },
140+ if r .Method == "POST" {
141+ testutil .AssertBody (t , api.CreateBuildRequest {
142+ Image : "nx/326:latest" ,
143+ Stack : "container" ,
144+ Procfile : map [string ]string {
145+ "web" : "./drive" ,
146+ "warp" : "./warp 8" ,
147+ },
148+ Dryccfile : map [string ]interface {}{
149+ "deploy" : map [string ]interface {}{
150+ "web" : map [string ]interface {}{
151+ "command" : []string {"bash" , "-c" },
152+ "args" : []string {"bundle exec puma -C config/puma.rb" },
153+ },
148154 },
149155 },
150- },
151- }, r )
156+ }, r )
157+ }
152158
153159 w .WriteHeader (http .StatusCreated )
154160 fmt .Fprintf (w , "{}" )
@@ -171,7 +177,7 @@ deploy:
171177` ), os .ModePerm )
172178 assert .NoError (t , err )
173179
174- err = cmdr .BuildsCreate ("franklin" , "nx/326:latest" , "container" , "Procfile" , "drycc.yaml" )
180+ err = cmdr .BuildsCreate ("franklin" , "nx/326:latest" , "container" , "Procfile" , "drycc.yaml" , "yes" )
175181 assert .NoError (t , err )
176182 assert .Equal (t , testutil .StripProgress (b .String ()), "Creating build... done\n " , "output" )
177183
0 commit comments