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

Commit bafdfbc

Browse files
committed
Get rid of deprecation warning in tests.
1 parent 6598c0b commit bafdfbc

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

test/test_u2f.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from u2flib_server.utils import websafe_decode, websafe_encode
66
from .soft_u2f_v2 import SoftU2FDevice
77
import unittest
8+
import six
89

910
APP_ID = 'https://www.example.com'
1011
APP_ID = 'http://www.example.com/appid'
@@ -140,11 +141,11 @@ def test_authenticate_soft_u2f(self):
140141
challenge1.complete(response1)
141142
challenge2.complete(response2)
142143

143-
self.assertRaisesRegexp(ValueError, 'challenge', challenge1.complete,
144-
response2)
144+
self.assertRaisesRegex(ValueError, 'challenge', challenge1.complete,
145+
response2)
145146

146-
self.assertRaisesRegexp(ValueError, 'challenge', challenge2.complete,
147-
response1)
147+
self.assertRaisesRegex(ValueError, 'challenge', challenge2.complete,
148+
response1)
148149

149150
def test_wrong_facet(self):
150151
token = SoftU2FDevice()
@@ -156,8 +157,8 @@ def test_wrong_facet(self):
156157
data['registerRequests'][0]
157158
)
158159

159-
self.assertRaisesRegexp(ValueError, 'facet', request.complete, response,
160-
FACETS)
160+
self.assertRaisesRegex(ValueError, 'facet', request.complete, response,
161+
FACETS)
161162

162163
response2 = token.register(
163164
FACET,
@@ -175,8 +176,8 @@ def test_wrong_facet(self):
175176
data['registeredKeys'][0]
176177
)
177178

178-
self.assertRaisesRegexp(ValueError, 'facet', signreq.complete, response,
179-
FACETS)
179+
self.assertRaisesRegex(ValueError, 'facet', signreq.complete, response,
180+
FACETS)
180181

181182
def test_wrong_challenge(self):
182183
device = SoftU2FDevice()
@@ -185,8 +186,8 @@ def test_wrong_challenge(self):
185186
response = device.register(FACET, data['appId'],
186187
data['registerRequests'][0])
187188
request2 = begin_registration(APP_ID)
188-
self.assertRaisesRegexp(ValueError, 'challenge', complete_registration,
189-
request2.json, response)
189+
self.assertRaisesRegex(ValueError, 'challenge', complete_registration,
190+
request2.json, response)
190191

191192
def test_invalid_signature(self):
192193
device = SoftU2FDevice()
@@ -200,5 +201,9 @@ def test_invalid_signature(self):
200201
response['registrationData'] = websafe_encode(raw_data)
201202
response = response.json
202203

203-
self.assertRaisesRegexp(ValueError, 'signature', complete_registration,
204-
request.json, response)
204+
self.assertRaisesRegex(ValueError, 'signature', complete_registration,
205+
request.json, response)
206+
207+
208+
if six.PY2:
209+
U2fTest.assertRaisesRegex = U2fTest.assertRaisesRegexp

0 commit comments

Comments
 (0)