~roadmr/canonical-identity-provider/fix-deprecation-warnings-1

« back to all changes in this revision

Viewing changes to src/identityprovider/tests/test_auth.py

  • Committer: Tom Wardill
  • Date: 2018-02-14 14:05:59 UTC
  • mfrom: (1602 work)
  • mto: (1597.1.44 django-1.10)
  • mto: This revision was merged to the branch mainline in revision 1603.
  • Revision ID: tom.wardill@canonical.com-20180214140559-ow5txzwy46nopws2
Merge flake8 changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from django.db import connection
23
23
from django.test.utils import override_settings
24
24
from django.utils.timezone import now
25
 
from mock import call, Mock, patch
 
25
from mock import Mock, call, patch
26
26
from pymacaroons import Verifier
27
27
 
28
28
from identityprovider.auth import (
36
36
    refresh_discharge,
37
37
    validate_oauth_signature,
38
38
)
39
 
from identityprovider.login import AuthenticationError, AccountDeactivated
 
39
from identityprovider.login import AccountDeactivated, AuthenticationError
40
40
from identityprovider.models import (
41
41
    Account,
42
42
    AccountPassword,
599
599
        self.assertEqual(result, self.token.secret)
600
600
 
601
601
    def test_get_access_token_secret_with_filter_matches_v2_token(self):
602
 
        token_filter = lambda token: 'test' not in token.name  # matches both
 
602
        def token_filter(token):
 
603
            return 'test' not in token.name  # matches both
603
604
        validator = SSORequestValidator(token_filter)
604
605
 
605
606
        result = validator.get_access_token_secret(
615
616
        self.assertEqual(result, self.validator.dummy_access_token)
616
617
 
617
618
    def test_get_access_token_secret_with_filter_matches_v1_token(self):
618
 
        token_filter = lambda token: token.name != 'test'
 
619
        def token_filter(token):
 
620
            return token.name != 'test'
619
621
        validator = SSORequestValidator(token_filter)
620
622
 
621
623
        result = validator.get_access_token_secret(