[tor-commits] [stem/master] Generalize assertion for invalid ONION_CLIENT_AUTH_ADD addresses

atagar at torproject.org atagar at torproject.org
Wed Aug 26 00:37:54 UTC 2020


commit 559fc6c55cb7936bba83f9817fc4fb07049a94dc
Author: Damian Johnson <atagar at torproject.org>
Date:   Tue Aug 25 17:33:08 2020 -0700

    Generalize assertion for invalid ONION_CLIENT_AUTH_ADD addresses
    
    Caught thanks to George...
    
    11:42 <+asn> atagar: hello
    11:42 <+asn> atagar: seems like the stem integration tests are failing travis:
      https://travis-ci.org/github/torproject/tor/jobs/720852838
    11:43 <+asn> atagar: is there a ticket for this?
    11:44 <+asn> atagar: if u want i can open one!
    23:56 <+atagar> asn: 'seems like the stem integration tests are failing
      travis' => I just compiled tor's master branch (commit d4f3cfe) and our
      integ tests pass. The problem looks to be that tor is testing its commit
      7915b651, which predates  https://gitlab.torproject.org/tpo/core/tor/-/issues/40005.
      Stem added its test after tor changed its response
      (https://gitweb.torproject.org/stem.git/commit/?id=0dba06fd).
    23:56 <+atagar> I'd be happy to merge a patch if you'd care to generalize
      the assertion.
---
 test/integ/control/controller.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index 6cd2f4e1..3a96c688 100644
--- a/test/integ/control/controller.py
+++ b/test/integ/control/controller.py
@@ -1635,17 +1635,24 @@ class TestController(unittest.TestCase):
     Exercises hidden service authentication with invalid data.
     """
 
+    # TODO: This checks for both 'addr' and 'address' because tor runs our
+    # integration tests both before and after...
+    #
+    #   https://gitlab.torproject.org/tpo/core/tor/-/issues/40005
+    #
+    # After a while we should be able to drop this.
+
     async with await test.runner.get_runner().get_tor_controller() as controller:
       invalid_service_id = 'xxxxxxxxyvhz3ofkv7gwf5hpzqvhonpr3gbax2cc7dee3xcnt7dmtlx2gu7vyvid'
-      exc_msg = "%%s response didn't have an OK status: Invalid v3 address \"%s\"" % invalid_service_id
+      exc_msg = "^%%s response didn't have an OK status: Invalid v3 (addr|address) \"%s\"$" % invalid_service_id
 
-      with self.assertRaisesWith(stem.ProtocolError, exc_msg % 'ONION_CLIENT_AUTH_ADD'):
+      with self.assertRaisesRegexp(stem.ProtocolError, exc_msg % 'ONION_CLIENT_AUTH_ADD'):
         await controller.add_hidden_service_auth(invalid_service_id, PRIVATE_KEY)
 
-      with self.assertRaisesWith(stem.ProtocolError, exc_msg % 'ONION_CLIENT_AUTH_REMOVE'):
+      with self.assertRaisesRegexp(stem.ProtocolError, exc_msg % 'ONION_CLIENT_AUTH_REMOVE'):
         await controller.remove_hidden_service_auth(invalid_service_id)
 
-      with self.assertRaisesWith(stem.ProtocolError, exc_msg % 'ONION_CLIENT_AUTH_VIEW'):
+      with self.assertRaisesRegexp(stem.ProtocolError, exc_msg % 'ONION_CLIENT_AUTH_VIEW'):
         await controller.list_hidden_service_auth(invalid_service_id)
 
       invalid_key = 'XXXXXXXXXFCV0c0ELDKKDpSFgVIB8Yow8Evj5iD+GoiTtK878NkQ='



More information about the tor-commits mailing list