@@ -196,9 +196,35 @@ func TestUpdateNonExistingAccount(t *testing.T) {
196196 test .AssertHTTPStatus (t , http .StatusNotFound , & recorder )
197197}
198198
199- func TestDeleteAccount (t * testing.T ) {
199+ func TestDeleteAccountsAndEmptyList (t * testing.T ) {
200200 recorder := test .Request (t , "DELETE" , "/v1/budgets/1/accounts/1" , "" )
201201 test .AssertHTTPStatus (t , http .StatusNoContent , & recorder )
202+
203+ recorder = test .Request (t , "DELETE" , "/v1/budgets/1/accounts/2" , "" )
204+ test .AssertHTTPStatus (t , http .StatusNoContent , & recorder )
205+
206+ recorder = test .Request (t , "DELETE" , "/v1/budgets/1/accounts/3" , "" )
207+ test .AssertHTTPStatus (t , http .StatusNoContent , & recorder )
208+
209+ recorder = test .Request (t , "DELETE" , "/v1/budgets/1/accounts/4" , "" )
210+ test .AssertHTTPStatus (t , http .StatusNoContent , & recorder )
211+
212+ recorder = test .Request (t , "DELETE" , "/v1/budgets/1/accounts/5" , "" )
213+ test .AssertHTTPStatus (t , http .StatusNoContent , & recorder )
214+
215+ recorder = test .Request (t , "DELETE" , "/v1/budgets/1/accounts/6" , "" )
216+ test .AssertHTTPStatus (t , http .StatusNoContent , & recorder )
217+
218+ recorder = test .Request (t , "GET" , "/v1/budgets/1/accounts" , "" )
219+ var apiResponse AccountListResponse
220+ err := json .NewDecoder (recorder .Body ).Decode (& apiResponse )
221+ if err != nil {
222+ assert .Fail (t , "Unable to parse response from server %q into APIListResponse, '%v'" , recorder .Body , err )
223+ }
224+
225+ // Verify that the account list is an empty list, not null
226+ assert .NotNil (t , apiResponse .Data )
227+ assert .Empty (t , apiResponse .Data )
202228}
203229
204230func TestDeleteNonExistingAccount (t * testing.T ) {
0 commit comments