120
126
class SessionResumeHelperTests(TestCase):
122
@mock.patch('plainbox.impl.session.resume.SessionResumeHelper1')
123
def test_resume_dispatch_v1(self, mocked_helper1):
124
data = gzip.compress(
125
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
126
b'{"app_blob":null,"flags":[],"running_job_name":null,"title":null'
127
b'},"results":{}},"version":1}')
128
SessionResumeHelper([], None, None).resume(data)
129
mocked_helper1.resume_json.assert_called_once()
131
@mock.patch('plainbox.impl.session.resume.SessionResumeHelper2')
132
def test_resume_dispatch_v2(self, mocked_helper2):
133
data = gzip.compress(
134
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
135
b'{"app_blob":null,"flags":[],"running_job_name":null,"title":null'
136
b'},"results":{}},"version":2}')
137
SessionResumeHelper([], None, None).resume(data)
138
mocked_helper2.resume_json.assert_called_once()
140
@mock.patch('plainbox.impl.session.resume.SessionResumeHelper3')
141
def test_resume_dispatch_v3(self, mocked_helper3):
142
data = gzip.compress(
143
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
144
b'{"app_blob":null,"app_id":null,"flags":[],'
145
b'"running_job_name":null,"title":null'
146
b'},"results":{}},"version":3}')
147
SessionResumeHelper([], None, None).resume(data)
148
mocked_helper3.resume_json.assert_called_once()
150
@mock.patch('plainbox.impl.session.resume.SessionResumeHelper4')
151
def test_resume_dispatch_v4(self, mocked_helper4):
152
data = gzip.compress(
153
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
154
b'{"app_blob":null,"app_id":null,"flags":[],'
155
b'"running_job_name":null,"title":null'
156
b'},"results":{}},"version":4}')
157
SessionResumeHelper([], None, None).resume(data)
158
mocked_helper4.resume_json.assert_called_once()
160
@mock.patch('plainbox.impl.session.resume.SessionResumeHelper5')
161
def test_resume_dispatch_v5(self, mocked_helper5):
162
data = gzip.compress(
163
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
164
b'{"app_blob":null,"app_id":null,"flags":[],'
165
b'"running_job_name":null,"title":null'
166
b'},"results":{}},"version":5}')
167
SessionResumeHelper([], None, None).resume(data)
168
mocked_helper5.resume_json.assert_called_once()
170
@mock.patch('plainbox.impl.session.resume.SessionResumeHelper6')
171
def test_resume_dispatch_v6(self, mocked_helper6):
172
data = gzip.compress(
173
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
174
b'{"app_blob":null,"app_id":null,"flags":[],'
175
b'"running_job_name":null,"title":null'
176
b'},"results":{}},"version":6}')
177
SessionResumeHelper([], None, None).resume(data)
178
mocked_helper6.resume_json.assert_called_once()
128
def test_resume_dispatch_v1(self):
129
helper1 = SessionResumeHelper1
130
with mock.patch.object(helper1, 'resume_json'):
131
data = gzip.compress(
132
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
133
b'{"app_blob":null,"flags":[],"running_job_name":null,'
134
b'"title":null},"results":{}},"version":1}')
135
SessionResumeHelper([], None, None).resume(data)
136
helper1.resume_json.assert_called_once_with(
137
{'session': {'jobs': {},
138
'metadata': {'title': None,
139
'running_job_name': None,
142
'desired_job_list': [],
146
def test_resume_dispatch_v2(self):
147
helper2 = SessionResumeHelper2
148
with mock.patch.object(helper2, 'resume_json'):
149
data = gzip.compress(
150
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
151
b'{"app_blob":null,"flags":[],"running_job_name":null,'
152
b'"title":null},"results":{}},"version":2}')
153
SessionResumeHelper([], None, None).resume(data)
154
helper2.resume_json.assert_called_once_with(
155
{'session': {'jobs': {},
156
'metadata': {'title': None,
157
'running_job_name': None,
160
'desired_job_list': [],
164
def test_resume_dispatch_v3(self):
165
helper3 = SessionResumeHelper3
166
with mock.patch.object(helper3, 'resume_json'):
167
data = gzip.compress(
168
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
169
b'{"app_blob":null,"app_id":null,"flags":[],'
170
b'"running_job_name":null,"title":null'
171
b'},"results":{}},"version":3}')
172
SessionResumeHelper([], None, None).resume(data)
173
helper3.resume_json.assert_called_once_with(
174
{'session': {'jobs': {},
175
'metadata': {'title': None,
177
'running_job_name': None,
180
'desired_job_list': [],
184
def test_resume_dispatch_v4(self):
185
helper4 = SessionResumeHelper4
186
with mock.patch.object(helper4, 'resume_json'):
187
data = gzip.compress(
188
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
189
b'{"app_blob":null,"app_id":null,"flags":[],'
190
b'"running_job_name":null,"title":null'
191
b'},"results":{}},"version":4}')
192
SessionResumeHelper([], None, None).resume(data)
193
helper4.resume_json.assert_called_once_with(
194
{'session': {'jobs': {},
195
'metadata': {'title': None,
197
'running_job_name': None,
200
'desired_job_list': [],
204
def test_resume_dispatch_v5(self):
205
helper5 = SessionResumeHelper5
206
with mock.patch.object(helper5, 'resume_json'):
207
data = gzip.compress(
208
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
209
b'{"app_blob":null,"app_id":null,"flags":[],'
210
b'"running_job_name":null,"title":null'
211
b'},"results":{}},"version":5}')
212
SessionResumeHelper([], None, None).resume(data)
213
helper5.resume_json.assert_called_once_with(
214
{'session': {'jobs': {},
215
'metadata': {'title': None,
217
'running_job_name': None,
220
'desired_job_list': [],
224
def test_resume_dispatch_v6(self):
225
helper6 = SessionResumeHelper6
226
with mock.patch.object(helper6, 'resume_json'):
227
data = gzip.compress(
228
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
229
b'{"app_blob":null,"app_id":null,"flags":[],'
230
b'"running_job_name":null,"title":null'
231
b'},"results":{}},"version":6}')
232
SessionResumeHelper([], None, None).resume(data)
233
helper6.resume_json.assert_called_once_with(
234
{'session': {'jobs': {},
235
'metadata': {'title': None,
237
'running_job_name': None,
240
'desired_job_list': [],
180
244
def test_resume_dispatch_v7(self):
181
245
data = gzip.compress(
188
252
class SessionPeekHelperTests(TestCase):
190
@mock.patch('plainbox.impl.session.resume.SessionPeekHelper1')
191
def test_peek_dispatch_v1(self, mocked_helper1):
192
data = gzip.compress(
193
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
194
b'{"app_blob":null,"flags":[],"running_job_name":null,"title":null'
195
b'},"results":{}},"version":1}')
196
SessionPeekHelper().peek(data)
197
mocked_helper1.resume_json.assert_called_once()
199
@mock.patch('plainbox.impl.session.resume.SessionPeekHelper2')
200
def test_peek_dispatch_v2(self, mocked_helper2):
201
data = gzip.compress(
202
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
203
b'{"app_blob":null,"flags":[],"running_job_name":null,"title":null'
204
b'},"results":{}},"version":2}')
205
SessionPeekHelper().peek(data)
206
mocked_helper2.resume_json.assert_called_once()
208
@mock.patch('plainbox.impl.session.resume.SessionPeekHelper3')
209
def test_peek_dispatch_v3(self, mocked_helper3):
210
data = gzip.compress(
211
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
212
b'{"app_blob":null,"flags":[],"running_job_name":null,"title":null'
213
b'},"results":{}},"version":3}')
214
SessionPeekHelper().peek(data)
215
mocked_helper3.resume_json.assert_called_once()
217
@mock.patch('plainbox.impl.session.resume.SessionPeekHelper4')
218
def test_peek_dispatch_v4(self, mocked_helper4):
219
data = gzip.compress(
220
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
221
b'{"app_blob":null,"flags":[],"running_job_name":null,"title":null'
222
b'},"results":{}},"version":4}')
223
SessionPeekHelper().peek(data)
224
mocked_helper4.resume_json.assert_called_once()
226
@mock.patch('plainbox.impl.session.resume.SessionPeekHelper5')
227
def test_peek_dispatch_v5(self, mocked_helper5):
228
data = gzip.compress(
229
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
230
b'{"app_blob":null,"flags":[],"running_job_name":null,"title":null'
231
b'},"results":{}},"version":5}')
232
SessionPeekHelper().peek(data)
233
mocked_helper5.resume_json.assert_called_once()
235
@mock.patch('plainbox.impl.session.resume.SessionPeekHelper6')
236
def test_peek_dispatch_v6(self, mocked_helper6):
237
data = gzip.compress(
238
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
239
b'{"app_blob":null,"flags":[],"running_job_name":null,"title":null'
240
b'},"results":{}},"version":6}')
241
SessionPeekHelper().peek(data)
242
mocked_helper6.resume_json.assert_called_once()
254
def test_peek_dispatch_v1(self):
255
helper1 = SessionPeekHelper1
256
with mock.patch.object(helper1, 'peek_json'):
257
data = gzip.compress(
258
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
259
b'{"app_blob":null,"flags":[],"running_job_name":null,'
260
b'"title":null},"results":{}},"version":1}')
261
SessionPeekHelper().peek(data)
262
helper1.peek_json.assert_called_once_with(
263
{'session': {'jobs': {},
264
'metadata': {'title': None,
265
'running_job_name': None,
268
'desired_job_list': [],
272
def test_peek_dispatch_v2(self):
273
helper2 = SessionPeekHelper2
274
with mock.patch.object(helper2, 'peek_json'):
275
data = gzip.compress(
276
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
277
b'{"app_blob":null,"flags":[],"running_job_name":null,'
278
b'"title":null},"results":{}},"version":2}')
279
SessionPeekHelper().peek(data)
280
helper2.peek_json.assert_called_once_with(
281
{'session': {'jobs': {},
282
'metadata': {'title': None,
283
'running_job_name': None,
286
'desired_job_list': [],
290
def test_peek_dispatch_v3(self):
291
helper3 = SessionPeekHelper3
292
with mock.patch.object(helper3, 'peek_json'):
293
data = gzip.compress(
294
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
295
b'{"app_blob":null,"flags":[],"running_job_name":null,'
296
b'"title":null},"results":{}},"version":3}')
297
SessionPeekHelper().peek(data)
298
helper3.peek_json.assert_called_once_with(
299
{'session': {'jobs': {},
300
'metadata': {'title': None,
301
'running_job_name': None,
304
'desired_job_list': [],
308
def test_peek_dispatch_v4(self):
309
helper4 = SessionPeekHelper4
310
with mock.patch.object(helper4, 'peek_json'):
311
data = gzip.compress(
312
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
313
b'{"app_blob":null,"flags":[],"running_job_name":null,'
314
b'"title":null},"results":{}},"version":4}')
315
SessionPeekHelper().peek(data)
316
helper4.peek_json.assert_called_once_with(
317
{'session': {'jobs': {},
318
'metadata': {'title': None,
319
'running_job_name': None,
322
'desired_job_list': [],
326
def test_peek_dispatch_v5(self):
327
helper5 = SessionPeekHelper5
328
with mock.patch.object(helper5, 'peek_json'):
329
data = gzip.compress(
330
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
331
b'{"app_blob":null,"flags":[],"running_job_name":null,'
332
b'"title":null},"results":{}},"version":5}')
333
SessionPeekHelper().peek(data)
334
helper5.peek_json.assert_called_once_with(
335
{'session': {'jobs': {},
336
'metadata': {'title': None,
337
'running_job_name': None,
340
'desired_job_list': [],
344
def test_peek_dispatch_v6(self):
345
helper6 = SessionPeekHelper6
346
with mock.patch.object(helper6, 'peek_json'):
347
data = gzip.compress(
348
b'{"session":{"desired_job_list":[],"jobs":{},"metadata":'
349
b'{"app_blob":null,"flags":[],"running_job_name":null,'
350
b'"title":null},"results":{}},"version":6}')
351
SessionPeekHelper().peek(data)
352
helper6.peek_json.assert_called_once_with(
353
{'session': {'jobs': {},
354
'metadata': {'title': None,
355
'running_job_name': None,
358
'desired_job_list': [],
244
363
class SessionResumeTests(TestCase):