Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
python-rsa.26684
remove_unittest2.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File remove_unittest2.patch of Package python-rsa.26684
--- a/run_tests.py +++ b/run_tests.py @@ -3,7 +3,7 @@ import os import sys -import unittest2 as unittest +import unittest current_path = os.path.abspath(os.path.dirname(__file__)) tests_path = os.path.join(current_path, 'tests') --- a/tests/test_bigfile.py +++ b/tests/test_bigfile.py @@ -5,12 +5,12 @@ try: from StringIO import StringIO as BytesIO except ImportError: from io import BytesIO -import unittest2 +import unittest import rsa from rsa import bigfile, varblock, pkcs1 -class BigfileTest(unittest2.TestCase): +class BigfileTest(unittest.TestCase): def test_encrypt_decrypt_bigfile(self): @@ -32,7 +32,7 @@ class BigfileTest(unittest2.TestCase): bigfile.decrypt_bigfile(cryptfile, clearfile, priv_key) self.assertEquals(clearfile.getvalue(), message) - + # We have 2x6 bytes in the message, so that should result in two # bigfile. cryptfile.seek(0) --- a/tests/test_common.py +++ b/tests/test_common.py @@ -1,13 +1,13 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -import unittest2 +import unittest import struct from rsa._compat import byte, b from rsa.common import byte_size, bit_size, _bit_size -class Test_byte(unittest2.TestCase): +class Test_byte(unittest.TestCase): def test_values(self): self.assertEqual(byte(0), b('\x00')) self.assertEqual(byte(255), b('\xff')) @@ -16,7 +16,7 @@ class Test_byte(unittest2.TestCase): self.assertRaises(struct.error, byte, 256) self.assertRaises(struct.error, byte, -1) -class Test_byte_size(unittest2.TestCase): +class Test_byte_size(unittest.TestCase): def test_values(self): self.assertEqual(byte_size(1 << 1023), 128) self.assertEqual(byte_size((1 << 1024) - 1), 128) @@ -41,7 +41,7 @@ class Test_byte_size(unittest2.TestCase) self.assertRaises(TypeError, byte_size, "") self.assertRaises(TypeError, byte_size, None) -class Test_bit_size(unittest2.TestCase): +class Test_bit_size(unittest.TestCase): def test_zero(self): self.assertEqual(bit_size(0), 0) --- a/tests/test_compat.py +++ b/tests/test_compat.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- -import unittest2 +import unittest import struct from rsa._compat import is_bytes, byte -class Test_byte(unittest2.TestCase): +class Test_byte(unittest.TestCase): def test_byte(self): for i in range(256): byt = byte(i) --- a/tests/test_integers.py +++ b/tests/test_integers.py @@ -1,10 +1,10 @@ '''Tests integer operations.''' -import unittest2 +import unittest import rsa.core -class IntegerTest(unittest2.TestCase): +class IntegerTest(unittest.TestCase): def setUp(self): (self.pub, self.priv) = rsa.newkeys(64) --- a/tests/test_load_save_keys.py +++ b/tests/test_load_save_keys.py @@ -1,7 +1,7 @@ '''Unittest for saving and loading keys.''' import base64 -import unittest2 +import unittest from rsa._compat import b import rsa.key @@ -53,7 +53,7 @@ CLEAN_PUBLIC_PEM = b('''\ ''' % B64PUB_DER.decode("utf-8")) -class DerTest(unittest2.TestCase): +class DerTest(unittest.TestCase): '''Test saving and loading DER keys.''' def test_load_private_key(self): @@ -88,7 +88,7 @@ class DerTest(unittest2.TestCase): self.assertEqual(PUBLIC_DER, der) -class PemTest(unittest2.TestCase): +class PemTest(unittest.TestCase): '''Test saving and loading PEM keys.''' --- a/tests/test_pem.py +++ b/tests/test_pem.py @@ -2,12 +2,12 @@ # -*- coding: utf-8 -*- -import unittest2 +import unittest from rsa._compat import b from rsa.pem import _markers -class Test__markers(unittest2.TestCase): +class Test__markers(unittest.TestCase): def test_values(self): self.assertEqual(_markers('RSA PRIVATE KEY'), (b('-----BEGIN RSA PRIVATE KEY-----'), --- a/tests/test_pkcs1.py +++ b/tests/test_pkcs1.py @@ -1,13 +1,13 @@ '''Tests string operations.''' import struct -import unittest2 +import unittest import rsa from rsa import pkcs1 from rsa._compat import byte, is_integer, b, is_bytes -class BinaryTest(unittest2.TestCase): +class BinaryTest(unittest.TestCase): def setUp(self): (self.pub, self.priv) = rsa.newkeys(256) @@ -35,7 +35,7 @@ class BinaryTest(unittest2.TestCase): if is_bytes(a): a = ord(a) encrypted = encrypted[:5] + byte(a + 1) + encrypted[6:] - + self.assertRaises(pkcs1.DecryptionError, pkcs1.decrypt, encrypted, self.priv) @@ -43,21 +43,21 @@ class BinaryTest(unittest2.TestCase): '''Encrypting the same message twice should result in different cryptos. ''' - + message = struct.pack('>IIII', 0, 0, 0, 1) encrypted1 = pkcs1.encrypt(message, self.pub) encrypted2 = pkcs1.encrypt(message, self.pub) - + self.assertNotEqual(encrypted1, encrypted2) -class SignatureTest(unittest2.TestCase): +class SignatureTest(unittest.TestCase): def setUp(self): (self.pub, self.priv) = rsa.newkeys(512) def test_sign_verify(self): '''Test happy flow of sign and verify''' - + message = b('je moeder') print("\tMessage: %r" % message) @@ -68,16 +68,16 @@ class SignatureTest(unittest2.TestCase): def test_alter_message(self): '''Altering the message should let the verification fail.''' - + signature = pkcs1.sign(b('je moeder'), self.priv, 'SHA-256') self.assertRaises(pkcs1.VerificationError, pkcs1.verify, b('mijn moeder'), signature, self.pub) def test_sign_different_key(self): '''Signing with another key should let the verification fail.''' - + (otherpub, _) = rsa.newkeys(512) - + message = b('je moeder') signature = pkcs1.sign(message, self.priv, 'SHA-256') self.assertRaises(pkcs1.VerificationError, pkcs1.verify, @@ -85,10 +85,10 @@ class SignatureTest(unittest2.TestCase): def test_multiple_signings(self): '''Signing the same message twice should return the same signatures.''' - + message = struct.pack('>IIII', 0, 0, 0, 1) signature1 = pkcs1.sign(message, self.priv, 'SHA-1') signature2 = pkcs1.sign(message, self.priv, 'SHA-1') - + self.assertEqual(signature1, signature2) --- a/tests/test_strings.py +++ b/tests/test_strings.py @@ -2,13 +2,13 @@ from __future__ import absolute_import -import unittest2 +import unittest import rsa from constants import unicode_string -class StringTest(unittest2.TestCase): +class StringTest(unittest.TestCase): def setUp(self): (self.pub, self.priv) = rsa.newkeys(384) --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -import unittest2 +import unittest from rsa._compat import b from rsa.transform import int2bytes, bytes2int, _int2bytes -class Test_int2bytes(unittest2.TestCase): +class Test_int2bytes(unittest.TestCase): def test_accuracy(self): self.assertEqual(int2bytes(123456789), b('\x07[\xcd\x15')) self.assertEqual(_int2bytes(123456789), b('\x07[\xcd\x15'))
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor