forked from pool/python-pyu2f
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pyu2f?expand=0&rev=13
149 lines
5.8 KiB
Diff
149 lines
5.8 KiB
Diff
Index: pyu2f-0.1.5a/pyu2f/tests/u2f_test.py
|
|
===================================================================
|
|
--- pyu2f-0.1.5a.orig/pyu2f/tests/u2f_test.py
|
|
+++ pyu2f-0.1.5a/pyu2f/tests/u2f_test.py
|
|
@@ -30,6 +30,9 @@ else:
|
|
|
|
class U2fTest(unittest.TestCase):
|
|
|
|
+ def assertEquals(self, *args, **kwargs):
|
|
+ return self.assertEqual(*args, **kwargs)
|
|
+
|
|
def testRegisterSuccessWithTUP(self):
|
|
mock_sk = mock.MagicMock()
|
|
mock_sk.CmdRegister.side_effect = [errors.TUPRequiredError, 'regdata']
|
|
Index: pyu2f-0.1.5a/pyu2f/tests/util_test.py
|
|
===================================================================
|
|
--- pyu2f-0.1.5a.orig/pyu2f/tests/util_test.py
|
|
+++ pyu2f-0.1.5a/pyu2f/tests/util_test.py
|
|
@@ -26,6 +26,9 @@ else:
|
|
|
|
class UtilTest(unittest.TestCase):
|
|
|
|
+ def assertEquals(self, *args, **kwargs):
|
|
+ return self.assertEqual(*args, **kwargs)
|
|
+
|
|
def testSimplePing(self):
|
|
dev = util.FakeHidDevice(cid_to_allocate=None)
|
|
dev.Write([0, 0, 0, 1, 0x81, 0, 3, 1, 2, 3])
|
|
Index: pyu2f-0.1.5a/pyu2f/tests/hid/macos_test.py
|
|
===================================================================
|
|
--- pyu2f-0.1.5a.orig/pyu2f/tests/hid/macos_test.py
|
|
+++ pyu2f-0.1.5a/pyu2f/tests/hid/macos_test.py
|
|
@@ -47,6 +47,9 @@ def init_mock_get_int_property(mock_get_
|
|
|
|
class MacOsTest(unittest.TestCase):
|
|
|
|
+ def assertEquals(self, *args, **kwargs):
|
|
+ return self.assertEqual(*args, **kwargs)
|
|
+
|
|
@mock.patch.object(macos.threading, 'Thread')
|
|
@mock.patch.multiple(macos, iokit=mock.DEFAULT, cf=mock.DEFAULT,
|
|
GetDeviceIntProperty=mock.DEFAULT)
|
|
Index: pyu2f-0.1.5a/pyu2f/tests/hid/linux_test.py
|
|
===================================================================
|
|
--- pyu2f-0.1.5a.orig/pyu2f/tests/hid/linux_test.py
|
|
+++ pyu2f-0.1.5a/pyu2f/tests/hid/linux_test.py
|
|
@@ -77,6 +77,10 @@ class FakeDeviceOsModule(object):
|
|
|
|
|
|
class LinuxTest(unittest.TestCase):
|
|
+
|
|
+ def assertEquals(self, *args, **kwargs):
|
|
+ return self.assertEqual(*args, **kwargs)
|
|
+
|
|
def setUp(self):
|
|
self.fs = fake_filesystem.FakeFilesystem()
|
|
self.fs.create_dir('/sys/class/hidraw')
|
|
Index: pyu2f-0.1.5a/pyu2f/tests/model_test.py
|
|
===================================================================
|
|
--- pyu2f-0.1.5a.orig/pyu2f/tests/model_test.py
|
|
+++ pyu2f-0.1.5a/pyu2f/tests/model_test.py
|
|
@@ -28,6 +28,9 @@ else:
|
|
|
|
class ModelTest(unittest.TestCase):
|
|
|
|
+ def assertEquals(self, *args, **kwargs):
|
|
+ return self.assertEqual(*args, **kwargs)
|
|
+
|
|
def testClientDataRegistration(self):
|
|
cd = model.ClientData(model.ClientData.TYP_REGISTRATION, b'ABCD',
|
|
'somemachine')
|
|
Index: pyu2f-0.1.5a/pyu2f/tests/localauthenticator_test.py
|
|
===================================================================
|
|
--- pyu2f-0.1.5a.orig/pyu2f/tests/localauthenticator_test.py
|
|
+++ pyu2f-0.1.5a/pyu2f/tests/localauthenticator_test.py
|
|
@@ -57,6 +57,9 @@ SIGN_SUCCESS['client_data'] = model.Clie
|
|
@mock.patch.object(sys, 'stderr', new=mock.MagicMock())
|
|
class LocalAuthenticatorTest(unittest.TestCase):
|
|
|
|
+ def assertEquals(self, *args, **kwargs):
|
|
+ return self.assertEqual(*args, **kwargs)
|
|
+
|
|
@mock.patch.object(localauthenticator.u2f, 'GetLocalU2FInterface')
|
|
def testSignSuccess(self, mock_get_u2f_method):
|
|
"""Test successful signing with a valid key."""
|
|
Index: pyu2f-0.1.5a/pyu2f/tests/hardware_test.py
|
|
===================================================================
|
|
--- pyu2f-0.1.5a.orig/pyu2f/tests/hardware_test.py
|
|
+++ pyu2f-0.1.5a/pyu2f/tests/hardware_test.py
|
|
@@ -29,6 +29,9 @@ else:
|
|
|
|
class HardwareTest(unittest.TestCase):
|
|
|
|
+ def assertEquals(self, *args, **kwargs):
|
|
+ return self.assertEqual(*args, **kwargs)
|
|
+
|
|
def testSimpleCommands(self):
|
|
mock_transport = mock.MagicMock()
|
|
sk = hardware.SecurityKey(mock_transport)
|
|
Index: pyu2f-0.1.5a/pyu2f/tests/hidtransport_test.py
|
|
===================================================================
|
|
--- pyu2f-0.1.5a.orig/pyu2f/tests/hidtransport_test.py
|
|
+++ pyu2f-0.1.5a/pyu2f/tests/hidtransport_test.py
|
|
@@ -56,6 +56,9 @@ def RPad(collection, to_size):
|
|
|
|
class DiscoveryTest(unittest.TestCase):
|
|
|
|
+ def assertEquals(self, *args, **kwargs):
|
|
+ return self.assertEqual(*args, **kwargs)
|
|
+
|
|
def testHidUsageSelector(self):
|
|
u2f_device = {'usage_page': 0xf1d0, 'usage': 0x01}
|
|
other_device = {'usage_page': 0x06, 'usage': 0x01}
|
|
@@ -98,6 +101,9 @@ class DiscoveryTest(unittest.TestCase):
|
|
|
|
class TransportTest(unittest.TestCase):
|
|
|
|
+ def assertEquals(self, *args, **kwargs):
|
|
+ return self.assertEqual(*args, **kwargs)
|
|
+
|
|
def testInit(self):
|
|
fake_hid_dev = util.FakeHidDevice(bytearray([0x00, 0x00, 0x00, 0x01]))
|
|
t = hidtransport.UsbHidTransport(fake_hid_dev)
|
|
@@ -128,8 +134,8 @@ class TransportTest(unittest.TestCase):
|
|
# the second will succeed on the second retry.
|
|
fake_hid_dev.SetChannelBusyCount(3)
|
|
with mock.patch.object(hidtransport, 'time') as _:
|
|
- self.assertRaisesRegexp(errors.HidError, '^Device Busy', t.SendMsgBytes,
|
|
- [0x00, 0x01, 0x00, 0x00])
|
|
+ self.assertRaisesRegex(errors.HidError, '^Device Busy', t.SendMsgBytes,
|
|
+ [0x00, 0x01, 0x00, 0x00])
|
|
|
|
reply = t.SendMsgBytes([0x00, 0x01, 0x00, 0x00])
|
|
self.assertEquals(reply, bytearray([0x01, 0x90, 0x00]))
|
|
Index: pyu2f-0.1.5a/pyu2f/tests/customauthenticator_test.py
|
|
===================================================================
|
|
--- pyu2f-0.1.5a.orig/pyu2f/tests/customauthenticator_test.py
|
|
+++ pyu2f-0.1.5a/pyu2f/tests/customauthenticator_test.py
|
|
@@ -57,6 +57,9 @@ SIGN_SUCCESS = {
|
|
@mock.patch.object(sys, 'stderr', new=mock.MagicMock())
|
|
class CustomAuthenticatorTest(unittest.TestCase):
|
|
|
|
+ def assertEquals(self, *args, **kwargs):
|
|
+ return self.assertEqual(*args, **kwargs)
|
|
+
|
|
@mock.patch.object(customauthenticator.os.environ, 'get', return_value=None)
|
|
def testEnvVarNotSet(self, os_get_method):
|
|
authenticator = customauthenticator.CustomAuthenticator('testorigin')
|