[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit ffb8d33ea9e5d4059c2a7c44f94e0daa845f707b
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
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



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits