@@ -96,3 +96,34 @@ def test_get_with_wait(self):
96
96
self .assertEqual (r2_json ["report" ], "" )
97
97
self .assertEqual (r2_json ["error" ], "" )
98
98
self .assertEqual (r2_json ["returncode" ], 0 )
99
+
100
+ def test_delete__204 (self ):
101
+ # create command process
102
+ r1 = self .client .post (
103
+ "/cmd/sleep" , json = {"args" : ["10" ], "force_unique_key" : True }
104
+ )
105
+ r1_json = r1 .get_json ()
106
+ self .assertStatus (r1 , 202 )
107
+ # request cancellation: correct key
108
+ r2 = self .client .delete (f"/cmd/sleep?key={ r1_json ['key' ]} " )
109
+ self .assertStatus (r2 , 204 )
110
+
111
+ def test_delete__400 (self ):
112
+ # create command process
113
+ r1 = self .client .post (
114
+ "/cmd/sleep" , json = {"args" : ["10" ], "force_unique_key" : True }
115
+ )
116
+ self .assertStatus (r1 , 202 )
117
+ # request cancellation: no key
118
+ r2 = self .client .delete ("/cmd/sleep?key=" )
119
+ self .assertStatus (r2 , 400 )
120
+
121
+ def test_delete__404 (self ):
122
+ # create command process
123
+ r1 = self .client .post (
124
+ "/cmd/sleep" , json = {"args" : ["10" ], "force_unique_key" : True }
125
+ )
126
+ self .assertStatus (r1 , 202 )
127
+ # request cancellation: invalid key
128
+ r2 = self .client .delete ("/cmd/sleep?key=abcdefg" )
129
+ self .assertStatus (r2 , 404 )
0 commit comments