From 45f89a62464106edbb5ace149074242c60e49a58 Mon Sep 17 00:00:00 2001 From: Amias Channer Date: Fri, 6 Sep 2024 15:02:06 +0200 Subject: [PATCH] Update functional_tests.py fixed 3rd party verifier tests that were failing because the verifier was being given the discharge macaroons at the wrong time and this caused a type error. switched from passing it to init() to verifier.verify() The last test is still broken , but a bit less now --- tests/functional_tests/functional_tests.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/functional_tests/functional_tests.py b/tests/functional_tests/functional_tests.py index a9dcb62..935cf25 100644 --- a/tests/functional_tests/functional_tests.py +++ b/tests/functional_tests/functional_tests.py @@ -360,13 +360,14 @@ def test_verify_third_party_caveats(self): discharge.add_first_party_caveat('time < 2015-01-01T00:00') protected = m.prepare_for_request(discharge) - v = Verifier(discharge_macaroons=[protected]) + v = Verifier() v.satisfy_exact('account = 3735928559') v.satisfy_exact('time < 2015-01-01T00:00') verified = v.verify( m, 'this is a different super-secret key; \ -never use the same secret twice' +never use the same secret twice', + [protected] ) assert verified @@ -386,7 +387,7 @@ def test_verify_third_party_caveats_multi_level(self): discharge1 = root.prepare_for_request(discharge1) discharge2 = root.prepare_for_request(discharge2) - verified = Verifier(discharge_macaroons=[discharge1, discharge2]).verify(root, "root-key") + verified = Verifier().verify(root, "root-key", [discharge1, discharge2]) assert verified @patch('nacl.secret.random') @@ -421,4 +422,4 @@ def test_mutual_discharge(self): m2.add_third_party_caveat("charlie", "bob-caveat-root-key", "bob-is-great") m2 = m1.prepare_for_request(m2) with pytest.raises(MacaroonUnmetCaveatException): - Verifier(discharge_macaroons=[m2]).verify(m1, "root-key") + Verifier().verify(m1, "root-key", [m2])