@@ -166,12 +166,47 @@ func TestDeploy(t *testing.T) {
166166 },
167167 stdin : []string {
168168 "Y" , // when prompted to create a new service
169+ "" , // when prompted for a service name use the default
170+ "Y" , // when prompted to approve the trial account setup
171+ "" , // this is so we generate a backend name using a built-in formula
172+ "" , // this stops prompting for backends
169173 },
170174 wantOutput : []string {
171- "INFO: You are creating a Compute trial service" ,
175+ "INFO: By creating this Compute service," ,
176+ "you acknowledge that the service is a trial service" ,
172177 "Deployed package (service 12345, version 1)" ,
173178 },
174179 },
180+ {
181+ // This test is the same as above but instead we don't configure a Y
182+ // response to the prompt asking if they want to start the trial account.
183+ // So this leads to an error.
184+ name : "error when declining trial account setup" ,
185+ args : args ("compute deploy --token 123 -v --package pkg/package.tar.gz" ),
186+ api : mock.API {
187+ ActivateVersionFn : activateVersionOk ,
188+ CreateBackendFn : createBackendOK ,
189+ CreateDomainFn : createDomainOK ,
190+ CreateServiceFn : createServiceOK ,
191+ GetPackageFn : getPackageOk ,
192+ ListDomainsFn : listDomainsOk ,
193+ UpdatePackageFn : updatePackageOk ,
194+ },
195+ httpClientRes : []* http.Response {
196+ {
197+ Body : io .NopCloser (strings .NewReader (`{"has_access":false}` )),
198+ Status : http .StatusText (http .StatusOK ),
199+ StatusCode : http .StatusOK ,
200+ },
201+ },
202+ httpClientErr : []error {
203+ nil ,
204+ },
205+ stdin : []string {
206+ "Y" , // when prompted to create a new service
207+ },
208+ wantError : "deploy stopped by user" ,
209+ },
175210 {
176211 // This test validates what happens when the entitlement check fails.
177212 name : "error checking compute entitlement" ,
0 commit comments