[tor-commits] [stem/master] Fix authentication test

atagar at torproject.org atagar at torproject.org
Wed Jul 29 23:58:18 UTC 2020


commit ffb8d33ea9e5d4059c2a7c44f94e0daa845f707b
Author: Damian Johnson <atagar at torproject.org>
Date:   Mon Jul 27 19:24:23 2020 -0700

    Fix authentication test
    
    Oops, we only exercise this line when using authentication (which isn't the
    default). Our tests now pass when using the RUN_ALL target.
    
      ======================================================================
      ERROR: test_authenticate_general_cookie
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/srv/jenkins-workspace/workspace/stem-tor-ci/test/require.py", line 75, in wrapped
          return func(self, *args, **kwargs)
        File "/srv/jenkins-workspace/workspace/stem-tor-ci/stem/util/test_tools.py", line 701, in wrapper
          result = loop.run_until_complete(func(*args, **kwargs))
        File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
          return future.result()
        File "/srv/jenkins-workspace/workspace/stem-tor-ci/test/integ/connection/authentication.py", line 221, in test_authenticate_general_cookie
          if method in protocolinfo_response.auth_methods:
      AttributeError: 'coroutine' object has no attribute 'auth_methods'
---
 test/integ/connection/authentication.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/integ/connection/authentication.py b/test/integ/connection/authentication.py
index bbca5e43..606f0c1d 100644
--- a/test/integ/connection/authentication.py
+++ b/test/integ/connection/authentication.py
@@ -216,7 +216,7 @@ class TestAuthenticate(unittest.TestCase):
     async with await runner.get_tor_socket(False) as control_socket:
       if is_cookie_only:
         for method in (stem.connection.AuthMethod.COOKIE, stem.connection.AuthMethod.SAFECOOKIE):
-          protocolinfo_response = stem.connection.get_protocolinfo(control_socket)
+          protocolinfo_response = await stem.connection.get_protocolinfo(control_socket)
 
           if method in protocolinfo_response.auth_methods:
             # narrow to *only* use cookie auth or safecooke, so we exercise
@@ -289,7 +289,7 @@ class TestAuthenticate(unittest.TestCase):
     for i in range(10):
       async with await runner.get_tor_controller(False) as controller:
         with self.assertRaises(stem.connection.IncorrectPassword):
-          controller.authenticate('wrong_password')
+          await controller.authenticate('wrong_password')
 
   @test.require.controller
   @async_test





More information about the tor-commits mailing list