[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Test when ADD_ONION uses basic auth but no clients
commit 98e66f8191a47934ea7f65ef4c58fff63fe2fc46
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Thu Jun 16 10:34:37 2016 -0700
Test when ADD_ONION uses basic auth but no clients
Interesting edge case. If you specify the basic auth flag but don't provide any
clients then tor balks.
---
test/integ/control/controller.py | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index 2bd06a6..7aa8a83 100644
--- a/test/integ/control/controller.py
+++ b/test/integ/control/controller.py
@@ -674,7 +674,7 @@ class TestController(unittest.TestCase):
@require_controller
@require_version(Requirement.ADD_ONION_BASIC_AUTH)
- def test_with_ephemeral_hidden_services_with_basic_auth(self):
+ def test_with_ephemeral_hidden_services_basic_auth(self):
"""
Exercises creating ephemeral hidden services that uses basic authentication.
"""
@@ -693,6 +693,23 @@ class TestController(unittest.TestCase):
self.assertEqual([], controller.list_ephemeral_hidden_services())
@require_controller
+ @require_version(Requirement.ADD_ONION_BASIC_AUTH)
+ def test_with_ephemeral_hidden_services_basic_auth_without_credentials(self):
+ """
+ Exercises creating ephemeral hidden services when attempting to use basic
+ auth but not including any credentials.
+ """
+
+ runner = test.runner.get_runner()
+
+ with runner.get_tor_controller() as controller:
+ try:
+ response = controller.create_ephemeral_hidden_service(4567, basic_auth = {})
+ self.fail('ADD_ONION should fail when using basic auth without any clients')
+ except stem.ProtocolError as exc:
+ self.assertEqual("ADD_ONION response didn't have an OK status: No auth clients specified", str(exc))
+
+ @require_controller
@require_version(Requirement.ADD_ONION)
def test_with_detached_ephemeral_hidden_services(self):
"""
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits