Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

Commit

Permalink
Get rid of deprecation warning in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
dainnilsson committed Mar 29, 2017
1 parent 6598c0b commit bafdfbc
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions test/test_u2f.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from u2flib_server.utils import websafe_decode, websafe_encode
from .soft_u2f_v2 import SoftU2FDevice
import unittest
import six

APP_ID = 'https://www.example.com'
APP_ID = 'http://www.example.com/appid'
Expand Down Expand Up @@ -140,11 +141,11 @@ def test_authenticate_soft_u2f(self):
challenge1.complete(response1)
challenge2.complete(response2)

self.assertRaisesRegexp(ValueError, 'challenge', challenge1.complete,
response2)
self.assertRaisesRegex(ValueError, 'challenge', challenge1.complete,
response2)

self.assertRaisesRegexp(ValueError, 'challenge', challenge2.complete,
response1)
self.assertRaisesRegex(ValueError, 'challenge', challenge2.complete,
response1)

def test_wrong_facet(self):
token = SoftU2FDevice()
Expand All @@ -156,8 +157,8 @@ def test_wrong_facet(self):
data['registerRequests'][0]
)

self.assertRaisesRegexp(ValueError, 'facet', request.complete, response,
FACETS)
self.assertRaisesRegex(ValueError, 'facet', request.complete, response,
FACETS)

response2 = token.register(
FACET,
Expand All @@ -175,8 +176,8 @@ def test_wrong_facet(self):
data['registeredKeys'][0]
)

self.assertRaisesRegexp(ValueError, 'facet', signreq.complete, response,
FACETS)
self.assertRaisesRegex(ValueError, 'facet', signreq.complete, response,
FACETS)

def test_wrong_challenge(self):
device = SoftU2FDevice()
Expand All @@ -185,8 +186,8 @@ def test_wrong_challenge(self):
response = device.register(FACET, data['appId'],
data['registerRequests'][0])
request2 = begin_registration(APP_ID)
self.assertRaisesRegexp(ValueError, 'challenge', complete_registration,
request2.json, response)
self.assertRaisesRegex(ValueError, 'challenge', complete_registration,
request2.json, response)

def test_invalid_signature(self):
device = SoftU2FDevice()
Expand All @@ -200,5 +201,9 @@ def test_invalid_signature(self):
response['registrationData'] = websafe_encode(raw_data)
response = response.json

self.assertRaisesRegexp(ValueError, 'signature', complete_registration,
request.json, response)
self.assertRaisesRegex(ValueError, 'signature', complete_registration,
request.json, response)


if six.PY2:
U2fTest.assertRaisesRegex = U2fTest.assertRaisesRegexp

0 comments on commit bafdfbc

Please sign in to comment.