[tor-commits] [stem/master] Integ for cookie auth failed due to missing cookie
atagar at torproject.org
atagar at torproject.org
Mon Jan 2 22:51:19 UTC 2012
commit b4f86854437d0e81cc1adb18de66ca46c49dabb4
Author: Damian Johnson <atagar at torproject.org>
Date: Mon Jan 2 14:49:12 2012 -0800
Integ for cookie auth failed due to missing cookie
If we're running the integ tests for the first time then it would fail because
it attempts cookie auth but the cookie file doesn't exist yet. This went
uncaught for quite a while because after the first test run we leave the data
directory (to speed up future test runs). Caught thanks to boerni.
---
test/integ/connection/authentication.py | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/test/integ/connection/authentication.py b/test/integ/connection/authentication.py
index 7ac745b..612e058 100644
--- a/test/integ/connection/authentication.py
+++ b/test/integ/connection/authentication.py
@@ -172,7 +172,15 @@ class TestAuthenticate(unittest.TestCase):
auth_type = stem.connection.AuthMethod.COOKIE
auth_value = test.runner.get_runner().get_auth_cookie_path()
- if self._can_authenticate(auth_type):
+ if not os.path.exists(auth_value):
+ # If the authentication cookie doesn't exist then we'll be getting an
+ # error for that rather than rejection. This will even fail if
+ # _can_authenticate is true because we *can* authenticate with cookie
+ # auth but the function will short circuit with failure due to the
+ # missing file.
+
+ self.assertRaises(stem.connection.UnreadableCookieFile, self._check_auth, auth_type, auth_value)
+ elif self._can_authenticate(auth_type):
self._check_auth(auth_type, auth_value)
else:
self.assertRaises(stem.connection.CookieAuthRejected, self._check_auth, auth_type, auth_value)
More information about the tor-commits
mailing list