Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:ecsos:python
python-pymacaroons
python-pymacaroons-remove-nose.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File python-pymacaroons-remove-nose.patch of Package python-pymacaroons
Index: pymacaroons-0.13.0/.coveragerc =================================================================== --- pymacaroons-0.13.0.orig/.coveragerc +++ pymacaroons-0.13.0/.coveragerc @@ -1,4 +1,3 @@ [report] omit = */python?.?/* - */site-packages/nose/* Index: pymacaroons-0.13.0/.gitignore =================================================================== --- pymacaroons-0.13.0.orig/.gitignore +++ pymacaroons-0.13.0/.gitignore @@ -36,7 +36,6 @@ htmlcov/ .tox/ .coverage .cache -nosetests.xml coverage.xml # Translations Index: pymacaroons-0.13.0/requirements.txt =================================================================== --- pymacaroons-0.13.0.orig/requirements.txt +++ pymacaroons-0.13.0/requirements.txt @@ -2,12 +2,11 @@ -e . # Test Dependencies -nose==1.3.7 coverage>=4.5,<4.99 mock>=2.0.0,<2.99 sphinx>=1.2.3 +pytest python-coveralls>=2.4.2 hypothesis==1.0.0 bumpversion tox -yanc Index: pymacaroons-0.13.0/tests/functional_tests/encrypted_field_tests.py =================================================================== --- pymacaroons-0.13.0.orig/tests/functional_tests/encrypted_field_tests.py +++ pymacaroons-0.13.0/tests/functional_tests/encrypted_field_tests.py @@ -1,7 +1,5 @@ from __future__ import unicode_literals -from nose.tools import * - from nacl.bindings import crypto_box_NONCEBYTES from pymacaroons import Macaroon, Verifier from pymacaroons.caveat_delegates import EncryptedFirstPartyCaveatDelegate, EncryptedFirstPartyCaveatVerifierDelegate @@ -26,10 +24,9 @@ class TestEncryptedFieldsMacaroon(object )) m.first_party_caveat_delegate = EncryptedFirstPartyCaveatDelegate(field_encryptor=encryptor) m.add_first_party_caveat('test = caveat', encrypted=True) - assert_equal( - m.signature, + assert\ + m.signature ==\ 'a443bc61e8f45dca4f0c441d6cfde90b804cebb0b267aab60de1ec2ab8cc8522' - ) def test_verify_encrypted_first_party_exact_caveats(self): m = Macaroon( @@ -47,4 +44,4 @@ class TestEncryptedFieldsMacaroon(object m, 'this is our super secret key; only we should know it' ) - assert_true(verified) + assert verified Index: pymacaroons-0.13.0/tests/functional_tests/functional_tests.py =================================================================== --- pymacaroons-0.13.0.orig/tests/functional_tests/functional_tests.py +++ pymacaroons-0.13.0/tests/functional_tests/functional_tests.py @@ -1,8 +1,7 @@ from __future__ import unicode_literals import json -from mock import * -from nose.tools import * +from unittest.mock import * from nacl.bindings import crypto_box_NONCEBYTES from pymacaroons import Macaroon, MACAROON_V1, MACAROON_V2, Verifier @@ -10,6 +9,7 @@ from pymacaroons.serializers import * from pymacaroons.exceptions import * from pymacaroons.utils import * +import pytest class TestMacaroon(object): @@ -22,10 +22,7 @@ class TestMacaroon(object): identifier='we used our secret key', key='this is our super secret key; only we should know it' ) - assert_equal( - m.signature, - 'e3d9e02908526c4c0039ae15114115d97fdd68bf2ba379b342aaf0f617d0552f' - ) + assert m.signature == 'e3d9e02908526c4c0039ae15114115d97fdd68bf2ba379b342aaf0f617d0552f' def test_first_party_caveat(self): m = Macaroon( @@ -34,10 +31,7 @@ class TestMacaroon(object): key='this is our super secret key; only we should know it' ) m.add_first_party_caveat('test = caveat') - assert_equal( - m.signature, - '197bac7a044af33332865b9266e26d493bdd668a660e44d88ce1a998c23dbd67' - ) + assert m.signature == '197bac7a044af33332865b9266e26d493bdd668a660e44d88ce1a998c23dbd67' def test_serializing(self): m = Macaroon( @@ -47,12 +41,9 @@ class TestMacaroon(object): version=MACAROON_V1 ) m.add_first_party_caveat('test = caveat') - assert_equal( - m.serialize(), - 'MDAxY2xvY2F0aW9uIGh0dHA6Ly9teWJhbmsvCjAwMjZpZGVudGlmaWVyIHdlIHVzZ\ + assert m.serialize() == 'MDAxY2xvY2F0aW9uIGh0dHA6Ly9teWJhbmsvCjAwMjZpZGVudGlmaWVyIHdlIHVzZ\ WQgb3VyIHNlY3JldCBrZXkKMDAxNmNpZCB0ZXN0ID0gY2F2ZWF0CjAwMmZzaWduYXR1cmUgGXusegR\ K8zMyhluSZuJtSTvdZopmDkTYjOGpmMI9vWcK' - ) def test_serializing_with_binary_v1(self): m = Macaroon( @@ -63,8 +54,8 @@ K8zMyhluSZuJtSTvdZopmDkTYjOGpmMI9vWcK' ) m.add_first_party_caveat('test = caveat') n = Macaroon.deserialize(m.serialize()) - assert_equal(m.identifier, n.identifier) - assert_equal(m.version, n.version) + assert m.identifier == n.identifier + assert m.version == n.version def test_serializing_with_binary_v2(self): identifier = base64.b64decode('AK2o+q0Aq9+bONkXw7ky7HAuhCLO9hhaMMc==') @@ -76,8 +67,8 @@ K8zMyhluSZuJtSTvdZopmDkTYjOGpmMI9vWcK' ) m.add_first_party_caveat('test = caveat') n = Macaroon.deserialize(m.serialize()) - assert_equal(m.identifier_bytes, n.identifier_bytes) - assert_equal(m.version, n.version) + assert m.identifier_bytes == n.identifier_bytes + assert m.version == n.version def test_serializing_v1(self): m = Macaroon( @@ -88,8 +79,8 @@ K8zMyhluSZuJtSTvdZopmDkTYjOGpmMI9vWcK' ) m.add_first_party_caveat('test = caveat') n = Macaroon.deserialize(m.serialize()) - assert_equal(m.identifier, n.identifier) - assert_equal(m.version, n.version) + assert m.identifier == n.identifier + assert m.version == n.version def test_serializing_v2(self): m = Macaroon( @@ -100,11 +91,11 @@ K8zMyhluSZuJtSTvdZopmDkTYjOGpmMI9vWcK' ) m.add_first_party_caveat('test = caveat') n = Macaroon.deserialize(m.serialize()) - assert_equal(m.identifier_bytes, n.identifier_bytes) - assert_equal(m.version, n.version) + assert m.identifier_bytes == n.identifier_bytes + assert m.version == n.version def test_deserializing_invalid(self): - with assert_raises(MacaroonDeserializationException) as cm: + with pytest.raises(MacaroonDeserializationException) as cm: Macaroon.deserialize("QA") def test_serializing_strips_padding(self): @@ -115,31 +106,22 @@ K8zMyhluSZuJtSTvdZopmDkTYjOGpmMI9vWcK' version=MACAROON_V1 ) m.add_first_party_caveat('test = acaveat') - assert_equal( - m.serialize(), - # In padded base64, this would end with '==' - ('MDAxY2xvY2F0aW9uIGh0dHA6Ly9teWJhbmsvCjAwMjZpZGVudGlmaWVyIHdlIHVz' - 'ZWQgb3VyIHNlY3JldCBrZXkKMDAxN2NpZCB0ZXN0ID0gYWNhdmVhdAowMDJmc2ln' + # In padded base64, this would end with '==' + assert m.serialize() == ('MDAxY2xvY2F0aW9uIGh0dHA6Ly9teWJhbmsvCjAwMjZpZGVudGlmaWVyIHdlIHVz'\ + 'ZWQgb3VyIHNlY3JldCBrZXkKMDAxN2NpZCB0ZXN0ID0gYWNhdmVhdAowMDJmc2ln'\ 'bmF0dXJlIJRJ_V3WNJQnqlVq5eez7spnltwU_AXs8NIRY739sHooCg') - ) def test_serializing_max_length_packet(self): m = Macaroon(location='test', identifier='blah', key='secret', version=MACAROON_V1) m.add_first_party_caveat('x' * 65526) # exactly 0xFFFF - assert_not_equal( - m.serialize(), - None - ) + assert m.serialize() != None def test_serializing_too_long_packet(self): m = Macaroon(location='test', identifier='blah', key='secret', version=MACAROON_V1) m.add_first_party_caveat('x' * 65527) # one byte too long - assert_raises( - MacaroonSerializationException, - m.serialize - ) + pytest.raises(MacaroonSerializationException, m.serialize) def test_deserializing(self): m = Macaroon.deserialize( @@ -147,10 +129,7 @@ K8zMyhluSZuJtSTvdZopmDkTYjOGpmMI9vWcK' VyIHdlIHVzZWQgb3VyIHNlY3JldCBrZXkKMDAxNmNpZCB0ZXN0ID0gY2F2ZWF0CjAwMmZzaWduYXR1\ cmUgGXusegRK8zMyhluSZuJtSTvdZopmDkTYjOGpmMI9vWcK' ) - assert_equal( - m.signature, - '197bac7a044af33332865b9266e26d493bdd668a660e44d88ce1a998c23dbd67' - ) + assert m.signature == '197bac7a044af33332865b9266e26d493bdd668a660e44d88ce1a998c23dbd67' def test_deserializing_with_binary(self): m = Macaroon.deserialize( @@ -158,10 +137,7 @@ cmUgGXusegRK8zMyhluSZuJtSTvdZopmDkTYjOGp VyIHdlIHVzZWQgb3VyIHNlY3JldCBrZXkKMDAxNmNpZCB0ZXN0ID0gY2F2ZWF0CjAwMmZzaWduYXR1\ cmUgGXusegRK8zMyhluSZuJtSTvdZopmDkTYjOGpmMI9vWcK'.encode('ascii') ) - assert_equal( - m.signature, - '197bac7a044af33332865b9266e26d493bdd668a660e44d88ce1a998c23dbd67' - ) + assert m.signature == '197bac7a044af33332865b9266e26d493bdd668a660e44d88ce1a998c23dbd67' def test_deserializing_accepts_padding(self): m = Macaroon.deserialize( @@ -169,10 +145,7 @@ cmUgGXusegRK8zMyhluSZuJtSTvdZopmDkTYjOGp 'ZWQgb3VyIHNlY3JldCBrZXkKMDAxN2NpZCB0ZXN0ID0gYWNhdmVhdAowMDJmc2ln' 'bmF0dXJlIJRJ_V3WNJQnqlVq5eez7spnltwU_AXs8NIRY739sHooCg==') ) - assert_equal( - m.signature, - '9449fd5dd6349427aa556ae5e7b3eeca6796dc14fc05ecf0d21163bdfdb07a28' - ) + assert m.signature == '9449fd5dd6349427aa556ae5e7b3eeca6796dc14fc05ecf0d21163bdfdb07a28' def test_serializing_json_v1(self): m = Macaroon( @@ -182,10 +155,8 @@ cmUgGXusegRK8zMyhluSZuJtSTvdZopmDkTYjOGp version=MACAROON_V1 ) m.add_first_party_caveat('test = caveat') - assert_equal( - json.loads(m.serialize(serializer=JsonSerializer()))['signature'], + assert json.loads(m.serialize(serializer=JsonSerializer()))['signature'] ==\ "197bac7a044af33332865b9266e26d493bdd668a660e44d88ce1a998c23dbd67" - ) def test_serializing_json_v2_with_binary(self): id = base64.b64decode('AK2o+q0Aq9+bONkXw7ky7HAuhCLO9hhaMMc==') @@ -195,15 +166,14 @@ cmUgGXusegRK8zMyhluSZuJtSTvdZopmDkTYjOGp key='this is our super secret key; only we should know it', version=MACAROON_V2 ) - assert_equal( - json.loads(m.serialize(serializer=JsonSerializer()))['i64'], + assert json.loads(m.serialize(serializer=JsonSerializer()))['i64'] ==\ "AK2o-q0Aq9-bONkXw7ky7HAuhCLO9hhaMMc" - ) + n = Macaroon.deserialize( m.serialize(serializer=JsonSerializer()), serializer=JsonSerializer() ) - assert_equal(m.identifier_bytes, n.identifier_bytes) + assert m.identifier_bytes == n.identifier_bytes def test_serializing_json_v2(self): m = Macaroon( @@ -213,10 +183,9 @@ cmUgGXusegRK8zMyhluSZuJtSTvdZopmDkTYjOGp version=MACAROON_V2 ) m.add_first_party_caveat('test = caveat') - assert_equal( - json.loads(m.serialize(serializer=JsonSerializer()))['s64'], + assert\ + json.loads(m.serialize(serializer=JsonSerializer()))['s64'] ==\ "GXusegRK8zMyhluSZuJtSTvdZopmDkTYjOGpmMI9vWc" - ) def test_deserializing_json_v1(self): m = Macaroon.deserialize( @@ -225,10 +194,9 @@ key", "signature": "197bac7a044af3333286 3dbd67", "caveats": [{"cl": null, "cid": "test = caveat", "vid": null}]}', serializer=JsonSerializer() ) - assert_equal( - m.signature, + assert\ + m.signature ==\ '197bac7a044af33332865b9266e26d493bdd668a660e44d88ce1a998c23dbd67' - ) def test_deserializing_json_v2(self): m = Macaroon.deserialize( @@ -237,10 +205,9 @@ key", "signature": "197bac7a044af3333286 ', "c": [{"l": null, "i": "test = caveat", "v": null}]}', serializer=JsonSerializer() ) - assert_equal( - m.signature_bytes, + assert \ + m.signature_bytes ==\ binascii.hexlify(b'197bac7a044af33332') - ) def test_serializing_deserializing_json_v1(self): self._serializing_deserializing_json_with_version(MACAROON_V1) @@ -260,7 +227,7 @@ key", "signature": "197bac7a044af3333286 m.serialize(serializer=JsonSerializer()), serializer=JsonSerializer() ) - assert_equal(m.signature, n.signature) + assert m.signature == n.signature def test_verify_first_party_exact_caveats(self): m = Macaroon( @@ -275,7 +242,7 @@ key", "signature": "197bac7a044af3333286 m, 'this is our super secret key; only we should know it' ) - assert_true(verified) + assert verified def test_verify_first_party_general_caveats(self): m = Macaroon( @@ -294,7 +261,7 @@ key", "signature": "197bac7a044af3333286 m, 'this is our super secret key; only we should know it' ) - assert_true(verified) + assert verified @patch('nacl.secret.random') def test_third_party_caveat(self, rand_nonce): @@ -313,10 +280,9 @@ never use the same secret twice' caveat_key = '4; guaranteed random by a fair toss of the dice' identifier = 'this was how we remind auth of key/pred' m.add_third_party_caveat('http://auth.mybank/', caveat_key, identifier) - assert_equal( - m.signature, + assert\ + m.signature ==\ 'd27db2fd1f22760e4c3dae8137e2d8fc1df6c0741c18aed4b97256bf78d1f55c' - ) def test_serializing_macaroon_with_first_and_third_caveats_v1(self): self._serializing_macaroon_with_first_and_third_caveats(MACAROON_V1) @@ -339,10 +305,7 @@ never use the same secret twice', n = Macaroon.deserialize(m.serialize()) - assert_equal( - m.signature, - n.signature - ) + assert m.signature == n.signature @patch('nacl.secret.random') def test_prepare_for_request(self, rand_nonce): @@ -373,10 +336,9 @@ never use the same secret twice' ) discharge.add_first_party_caveat('time < 2015-01-01T00:00') protected = m.prepare_for_request(discharge) - assert_equal( - protected.signature, + assert\ + protected.signature ==\ '2eb01d0dd2b4475330739140188648cf25dda0425ea9f661f1574ca0a9eac54e' - ) def test_verify_third_party_caveats(self): m = Macaroon( @@ -407,7 +369,7 @@ never use the same secret twice' never use the same secret twice', discharge_macaroons=[protected] ) - assert_true(verified) + assert verified def test_verify_third_party_caveats_multi_level(self): # See https://github.com/ecordell/pymacaroons/issues/37 @@ -426,7 +388,7 @@ never use the same secret twice', discharge2 = root.prepare_for_request(discharge2) verified = Verifier().verify(root, "root-key", [discharge1, discharge2]) - assert_true(verified) + assert verified @patch('nacl.secret.random') def test_inspect(self, rand_nonce): @@ -444,11 +406,11 @@ never use the same secret twice', caveat_key = '4; guaranteed random by a fair toss of the dice' identifier = 'this was how we remind auth of key/pred' m.add_third_party_caveat('http://auth.mybank/', caveat_key, identifier) - assert_equal(m.inspect(), ( + assert m.inspect() == ( 'location http://mybank/\n' 'identifier we used our secret key\n' 'cid test = caveat\n' 'cid this was how we remind auth of key/pred\n' 'vid AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA68NYajhiFuHnKGSNcVhkAwgbs0VZ0yK2o+q0Aq9+bONkXw7ky7HAuhCLO9hhaMMc\n' 'cl http://auth.mybank/\n' - 'signature 7a9289bfbb92d725f748bbcb4f3e04e56b7021513ebeed8411bfba10a16a662e')) + 'signature 7a9289bfbb92d725f748bbcb4f3e04e56b7021513ebeed8411bfba10a16a662e') Index: pymacaroons-0.13.0/tests/functional_tests/serialization_tests.py =================================================================== --- pymacaroons-0.13.0.orig/tests/functional_tests/serialization_tests.py +++ pymacaroons-0.13.0/tests/functional_tests/serialization_tests.py @@ -1,4 +1,4 @@ -from nose.tools import * +import pytest from pymacaroons import Macaroon, Verifier, MACAROON_V1, MACAROON_V2 from pymacaroons.serializers import JsonSerializer @@ -66,9 +66,9 @@ class TestSerializationCompatibility(obj def assert_macaroon(m, discharge, version): - assert_equal(m.location, 'my location') - assert_equal(m.version, version) - assert_equal(m.identifier_bytes, b'my identifier') + assert m.location == 'my location' + assert m.version == version + assert m.identifier_bytes == b'my identifier' v = Verifier() v.satisfy_exact('fp caveat') verified = v.verify( @@ -76,4 +76,4 @@ def assert_macaroon(m, discharge, versio "my secret key", discharge_macaroons=[discharge], ) - assert_true(verified) + assert verified Index: pymacaroons-0.13.0/tests/property_tests/macaroon_property_tests.py =================================================================== --- pymacaroons-0.13.0.orig/tests/property_tests/macaroon_property_tests.py +++ pymacaroons-0.13.0/tests/property_tests/macaroon_property_tests.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -from nose.tools import * from hypothesis import * from hypothesis.specifiers import * @@ -36,9 +35,9 @@ class TestMacaroon(object): version=MACAROON_V1 ) deserialized = Macaroon.deserialize(macaroon.serialize()) - assert_equal(macaroon.identifier, deserialized.identifier) - assert_equal(macaroon.location, deserialized.location) - assert_equal(macaroon.signature, deserialized.signature) + assert macaroon.identifier == deserialized.identifier + assert macaroon.location == deserialized.location + assert macaroon.signature == deserialized.signature macaroon = Macaroon( location=loc, identifier=key_id, @@ -46,6 +45,6 @@ class TestMacaroon(object): version=MACAROON_V2 ) deserialized = Macaroon.deserialize(macaroon.serialize()) - assert_equal(macaroon.identifier_bytes, deserialized.identifier_bytes) - assert_equal(macaroon.location, deserialized.location) - assert_equal(macaroon.signature, deserialized.signature) + assert macaroon.identifier_bytes == deserialized.identifier_bytes + assert macaroon.location == deserialized.location + assert macaroon.signature == deserialized.signature Index: pymacaroons-0.13.0/tox.ini =================================================================== --- pymacaroons-0.13.0.orig/tox.ini +++ pymacaroons-0.13.0/tox.ini @@ -5,12 +5,12 @@ skip_missing_interpreters=True [testenv] deps=-rrequirements.txt commands= - nosetests --with-yanc + pytest --color=yes [testenv:py26] deps=-rrequirements.txt commands= - nosetests tests/functional_tests --with-yanc + pytest --color=yes tests/functional_tests [testenv:docs] basepython=python @@ -28,4 +28,4 @@ commands= [testenv:coverage] deps=-rrequirements.txt commands= - nosetests --with-coverage --cover-erase --cover-package=pymacaroons + pytest --cov=pymacaroons tests/ Index: pymacaroons-0.13.0/pytest.ini =================================================================== --- /dev/null +++ pymacaroons-0.13.0/pytest.ini @@ -0,0 +1,5 @@ +[pytest] +python_files = *test*.py +testpaths = tests/ +addopts = -v +
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