[Pkg-privacy-commits] [txtorcon] 44/96: better test and docs for issue #88
Jérémy Bobbio
lunar at moszumanska.debian.org
Sun Sep 6 18:33:38 UTC 2015
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch master
in repository txtorcon.
commit eaf8c861e2a7053ffbc52d3d5e1c8eae8e857b12
Author: meejah <meejah at meejah.ca>
Date: Tue Feb 3 12:24:27 2015 -0700
better test and docs for issue #88
---
test/test_torconfig.py | 8 ++++++++
txtorcon/torconfig.py | 15 +++++++--------
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/test/test_torconfig.py b/test/test_torconfig.py
index a2e57ac..6101a33 100644
--- a/test/test_torconfig.py
+++ b/test/test_torconfig.py
@@ -276,6 +276,14 @@ class ConfigTests(unittest.TestCase):
self.assertEqual(conf.get_type('SomethingExciting'), CommaList)
self.assertEqual(conf.get_type('HiddenServices'), HiddenService)
+ def test_immediate_hiddenservice_append(self):
+ '''issue #88. we check that a .append(hs) works on a blank TorConfig'''
+ conf = TorConfig()
+ hs = HiddenService(conf, '/dev/null', ['80 127.0.0.1:1234'])
+ conf.HiddenServices.append(hs)
+ self.assertEqual(len(conf.HiddenServices), 1)
+ self.assertEqual(conf.HiddenServices[0], hs)
+
def foo(self, *args):
print "FOOO", args
diff --git a/txtorcon/torconfig.py b/txtorcon/torconfig.py
index ffdd0d3..e46166b 100644
--- a/txtorcon/torconfig.py
+++ b/txtorcon/torconfig.py
@@ -719,16 +719,15 @@ class HiddenService(object):
class TorConfig(object):
- """This class abstracts out Tor's config so that you don't have to
- realize things like: in order to successfully set multiple listen
- addresses, you must put them all (and the or-ports) in one SETCONF
- call.
+ """This class abstracts out Tor's config, and can be used both to
+ create torrc files from nothing and track live configuration of a Tor
+ instance.
Also, it gives easy access to all the configuration options
- present. This is loaded at "bootstrap" time (when all values are
- loaded) providing attribute-based access thereafter. Note that
- after you set some number of items, you need to do a save() before
- these are sent to Tor (and then they will be done as one SETCONF).
+ present. This is initialized at "bootstrap" time, providing
+ attribute-based access thereafter. Note that after you set some
+ number of items, you need to do a save() before these are sent to
+ Tor (and then they will be done as one SETCONF).
You may also use this class to construct a configuration from
scratch (e.g. to give to :func:`txtorcon.launch_tor`). In this
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/txtorcon.git
More information about the Pkg-privacy-commits
mailing list