@@ -129,3 +129,98 @@ def test_06_batch_distributed(self):
129
129
["distributed" , False , date .today ()],
130
130
"Test Queue status should be `distributed`!" ,
131
131
)
132
+
133
+ def create_test_batch (self ):
134
+ queue_1 = self ._create_test_queue (self ._test_individual_1 .id , self .id_type )
135
+ queue_2 = self ._create_test_queue (self ._test_individual_1 .id , self .id_type )
136
+ queue_3 = self ._create_test_queue (self ._test_individual_1 .id , self .id_type )
137
+ queue_4 = self ._create_test_queue (self ._test_individual_1 .id , self .id_type )
138
+ batch = self .env ["spp.print.queue.batch" ].create (
139
+ {
140
+ "name" : "TEST BATCH 02" ,
141
+ "queued_ids" : [
142
+ (4 , queue_1 .id ),
143
+ (4 , queue_2 .id ),
144
+ (4 , queue_3 .id ),
145
+ (4 , queue_4 .id ),
146
+ ],
147
+ }
148
+ )
149
+ return batch
150
+
151
+ def test_07_multi_approve_batch (self ):
152
+ batch = self .create_test_batch ()
153
+ batch .multi_approve_batch ()
154
+ self .assertListEqual (
155
+ [
156
+ batch .status ,
157
+ ],
158
+ ["approved" ],
159
+ "Test batches should now be in `approved` status!" ,
160
+ )
161
+
162
+ def test_08_multi_generate_batch (self ):
163
+ batch = self .create_test_batch ()
164
+ batch .multi_approve_batch ()
165
+ batch .multi_generate_batch ()
166
+ self .assertListEqual (
167
+ [
168
+ batch .status ,
169
+ ],
170
+ ["generating" ],
171
+ "Test batches should now be in `generating` status!" ,
172
+ )
173
+
174
+ def test_09_multi_print_batch (self ):
175
+ batch = self .create_test_batch ()
176
+ batch .multi_approve_batch ()
177
+ batch .status = "generated"
178
+ batch .merge_status = "merged"
179
+ for queues in batch .queued_ids :
180
+ queues .status = "approved"
181
+
182
+ batch .multi_print_batch ()
183
+ self .assertListEqual (
184
+ [
185
+ batch .status ,
186
+ ],
187
+ ["printing" ],
188
+ "Test batches should now be in `printing` status!" ,
189
+ )
190
+
191
+ def test_10_multi_printed_batch (self ):
192
+ batch = self .create_test_batch ()
193
+ batch .multi_approve_batch ()
194
+ batch .status = "generated"
195
+ batch .merge_status = "merged"
196
+ for queues in batch .queued_ids :
197
+ queues .status = "approved"
198
+
199
+ batch .multi_print_batch ()
200
+ batch .multi_printed_batch ()
201
+ self .assertListEqual (
202
+ [
203
+ batch .status ,
204
+ ],
205
+ ["printed" ],
206
+ "Test batches should now be in `printed` status!" ,
207
+ )
208
+
209
+ def test_11_multi_distributed_batch (self ):
210
+ batch = self .create_test_batch ()
211
+ batch .multi_approve_batch ()
212
+ batch .status = "generated"
213
+ batch .merge_status = "merged"
214
+ for queues in batch .queued_ids :
215
+ queues .status = "approved"
216
+
217
+ batch .multi_print_batch ()
218
+ batch .multi_printed_batch ()
219
+ batch .multi_distribute_batch ()
220
+ self .assertListEqual (
221
+ [
222
+ batch .status ,
223
+ ],
224
+ ["distributed" ],
225
+ "Test batches should now be in `distributed` status!" ,
226
+ )
0 commit comments