~mvo/ubuntu-sso-client/strawman-lp711413

« back to all changes in this revision

Viewing changes to ubuntu_sso/main/tests/test_windows.py

Fix pylint warnings

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
    SSOLoginClient,
41
41
    UbuntuSSORoot)
42
42
 
43
 
# because we are using twisted we have java like names C0103
44
 
# pylint: disable=C0103
 
43
# because we are using twisted we have java like names C0103 and
 
44
# the issues that mocker brings with it like W0104
 
45
# pylint: disable=C0103,W0104
45
46
 
46
47
 
47
48
class SaveProtocolServerFactory(PBServerFactory):
141
142
    def test_emit_captcha_generation_error(self):
142
143
        """Test that the cb was called."""
143
144
        app_name = 'app'
144
 
        raised_error = 'error'
 
145
        error_value = 'error'
 
146
        raised_error = self.mocker.mock()
145
147
 
146
148
        @defer.inlineCallbacks
147
149
        def test_emit(client):
148
150
            """Actual test."""
149
 
            self.except_to_errdict(raised_error)
150
 
            self.mocker.result(raised_error)
151
 
            client.on_captcha_generation_error_cb(app_name, raised_error)
 
151
            raised_error.value
 
152
            self.mocker.result(error_value)
 
153
            self.except_to_errdict(error_value)
 
154
            self.mocker.result(error_value)
 
155
            client.on_captcha_generation_error_cb(app_name, error_value)
152
156
            self.mocker.replay()
153
157
            self.login.emit_captcha_generation_error(app_name, raised_error)
154
158
            yield client.unregister_to_signals()
205
209
    def test_emit_user_registration_error(self):
206
210
        """Test that the cb was called."""
207
211
        app_name = 'app'
208
 
        raised_error = 'error'
 
212
        error_value = 'error'
 
213
        raised_error = self.mocker.mock()
209
214
 
210
215
        @defer.inlineCallbacks
211
216
        def test_emit(client):
212
217
            """Actual test."""
213
 
            self.except_to_errdict(raised_error)
214
 
            self.mocker.result(raised_error)
215
 
            client.on_user_registration_error_cb(app_name, raised_error)
 
218
            raised_error.value
 
219
            self.mocker.result(error_value)
 
220
            self.except_to_errdict(error_value)
 
221
            self.mocker.result(error_value)
 
222
            client.on_user_registration_error_cb(app_name, error_value)
216
223
            self.mocker.replay()
217
224
            self.login.emit_user_registration_error(app_name, raised_error)
218
225
            yield client.unregister_to_signals()
275
282
    def test_emit_login_error(self):
276
283
        """Test that the db was called."""
277
284
        app_name = 'app'
278
 
        raised_error = 'error'
 
285
        error_value = 'error'
 
286
        raised_error = self.mocker.mock()
279
287
 
280
288
        @defer.inlineCallbacks
281
289
        def test_emit(client):
282
290
            """Actual test."""
283
 
            self.except_to_errdict(raised_error)
284
 
            self.mocker.result(raised_error)
285
 
            client.on_login_error_cb(app_name, raised_error)
 
291
            raised_error.value
 
292
            self.mocker.result(error_value)
 
293
            self.except_to_errdict(error_value)
 
294
            self.mocker.result(error_value)
 
295
            client.on_login_error_cb(app_name, error_value)
286
296
            self.mocker.replay()
287
297
            self.login.emit_login_error(app_name, raised_error)
288
298
            yield client.unregister_to_signals()
361
371
    def test_emit_email_validation_error(self):
362
372
        """Test the cb was called."""
363
373
        app_name = 'app'
364
 
        raised_error = 'error'
 
374
        error_value = 'error'
 
375
        raised_error = self.mocker.mock()
365
376
 
366
377
        @defer.inlineCallbacks
367
378
        def test_emit(client):
368
379
            """Actual test."""
369
 
            self.except_to_errdict(raised_error)
370
 
            self.mocker.result(raised_error)
371
 
            client.on_email_validation_error_cb(app_name, raised_error)
 
380
            raised_error.value
 
381
            self.mocker.result(error_value)
 
382
            self.except_to_errdict(error_value)
 
383
            self.mocker.result(error_value)
 
384
            client.on_email_validation_error_cb(app_name, error_value)
372
385
            self.mocker.replay()
373
386
            self.login.emit_email_validation_error(app_name, raised_error)
374
387
            yield client.unregister_to_signals()
427
440
    def test_emit_password_reset_error(self):
428
441
        """Test the cb was called."""
429
442
        app_name = 'app'
430
 
        raised_error = 'error'
 
443
        error_value = 'error'
 
444
        raised_error = self.mocker.mock()
431
445
 
432
446
        @defer.inlineCallbacks
433
447
        def test_emit(client):
434
448
            """Actual test."""
435
 
            self.except_to_errdict(raised_error)
436
 
            self.mocker.result(raised_error)
437
 
            client.on_password_reset_error_cb(app_name, raised_error)
 
449
            raised_error.value
 
450
            self.mocker.result(error_value)
 
451
            self.except_to_errdict(error_value)
 
452
            self.mocker.result(error_value)
 
453
            client.on_password_reset_error_cb(app_name, error_value)
438
454
            self.mocker.replay()
439
455
            self.login.emit_password_reset_error(app_name, raised_error)
440
456
            yield client.unregister_to_signals()
491
507
    def test_emit_password_change_error(self):
492
508
        """Test the cb was called."""
493
509
        app_name = 'app'
494
 
        raised_error = 'error'
 
510
        error_value = 'error'
 
511
        raised_error = self.mocker.mock()
495
512
 
496
513
        @defer.inlineCallbacks
497
514
        def test_emit(client):
498
515
            """Actual test."""
499
 
            self.except_to_errdict(raised_error)
500
 
            self.mocker.result(raised_error)
501
 
            client.on_password_change_error(app_name, raised_error)
 
516
            raised_error.value
 
517
            self.mocker.result(error_value)
 
518
            self.except_to_errdict(error_value)
 
519
            self.mocker.result(error_value)
 
520
            client.on_password_change_error(app_name, error_value)
502
521
            self.mocker.replay()
503
522
            self.login.emit_password_change_error(app_name, raised_error)
504
523
            yield client.unregister_to_signals()