[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Integ test for basic usage example
commit 50ac2381a069a9e72094ff210954f9db1bdad0cb
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Fri Mar 9 20:12:42 2012 -0800
Integ test for basic usage example
The header documentation contains two examples - the equivilant to 'hello
world' with this class and an example of making use of the high water mark the
DescriptorReader tracks. This adds an integ test for the first.
At present this integ test dies in a fiery... well, fire. This is because the
DescriptorReader isn't yet implemented. That's next...
---
test/integ/descriptor/data/example_descriptor | 30 +++++++++++++++++++++++++
test/integ/descriptor/reader.py | 15 ++++++++++++
2 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/test/integ/descriptor/data/example_descriptor b/test/integ/descriptor/data/example_descriptor
new file mode 100644
index 0000000..5ab4f57
--- /dev/null
+++ b/test/integ/descriptor/data/example_descriptor
@@ -0,0 +1,30 @@
+router caerSidi 71.35.133.197 9001 0 0
+platform Tor 0.2.1.30 on Linux x86_64
+opt protocols Link 1 2 Circuit 1
+published 2012-03-01 17:15:27
+opt fingerprint A756 9A83 B570 6AB1 B1A9 CB52 EFF7 D2D3 2E45 53EB
+uptime 588217
+bandwidth 153600 256000 104590
+opt extra-info-digest D225B728768D7EA4B5587C13A7A9D22EBBEE6E66
+onion-key
+-----BEGIN RSA PUBLIC KEY-----
+MIGJAoGBAJv5IIWQ+WDWYUdyA/0L8qbIkEVH/cwryZWoIaPAzINfrw1WfNZGtBmg
+skFtXhOHHqTRN4GPPrZsAIUOQGzQtGb66IQgT4tO/pj+P6QmSCCdTfhvGfgTCsC+
+WPi4Fl2qryzTb3QO5r5x7T8OsG2IBUET1bLQzmtbC560SYR49IvVAgMBAAE=
+-----END RSA PUBLIC KEY-----
+signing-key
+-----BEGIN RSA PUBLIC KEY-----
+MIGJAoGBAKwvOXyztVKnuYvpTKt+nS3XIKeO8dVungi8qGoeS+6gkR6lDtGfBTjd
+uE9UIkdAl9zi8/1Ic2wsUNHE9jiS0VgeupITGZY8YOyMJJ/xtV1cqgiWhq1dUYaq
+51TOtUogtAPgXPh4J+V8HbFFIcCzIh3qCO/xXo+DSHhv7SSif1VpAgMBAAE=
+-----END RSA PUBLIC KEY-----
+family $0CE3CFB1E9CC47B63EA8869813BF6FAB7D4540C1 $1FD187E8F69A9B74C9202DC16A25B9E7744AB9F6 $74FB5EFA6A46DE4060431D515DC9A790E6AD9A7C $77001D8DA9BF445B0F81AA427A675F570D222E6A $B6D83EC2D9E18B0A7A33428F8CFA9C536769E209 $D2F37F46182C23AB747787FD657E680B34EAF892 $E0BD57A11F00041A9789577C53A1B784473669E4 $E5E3E9A472EAF7BE9682B86E92305DB4C71048EF
+opt hidden-service-dir
+contact www.atagar.com/contact
+reject *:*
+router-signature
+-----BEGIN SIGNATURE-----
+dskLSPz8beUW7bzwDjR6EVNGpyoZde83Ejvau+5F2c6cGnlu91fiZN3suE88iE6e
+758b9ldq5eh5mapb8vuuV3uO+0Xsud7IEOqfxdkmk0GKnUX8ouru7DSIUzUL0zqq
+Qlx9HNCqCY877ztFRC624ja2ql6A2hBcuoYMbkHjcQ4=
+-----END SIGNATURE-----
diff --git a/test/integ/descriptor/reader.py b/test/integ/descriptor/reader.py
index 6341153..4ab2792 100644
--- a/test/integ/descriptor/reader.py
+++ b/test/integ/descriptor/reader.py
@@ -14,6 +14,9 @@ BASIC_LISTING = """
/file with spaces/and \\ stuff 890
"""
+my_dir = os.path.dirname(__file__)
+DESCRIPTOR_TEST_DATA = os.path.join(my_dir, "data")
+
def _get_processed_files_path():
return os.path.join(test.runner.get_runner().get_test_dir(), "descriptor_processed_files")
@@ -101,4 +104,16 @@ class TestDescriptorReader(unittest.TestCase):
for listing in (missing_filename, relative_filename, string_timestamp):
self.assertRaises(TypeError, stem.descriptor.reader.save_processed_files, listing, "/tmp/foo")
+
+ def test_basic_example(self):
+ """
+ Exercises something similar to the first example in the header
+ documentation, checking that the contetns match the actual file.
+ """
+
+ reader = stem.descriptor.reader.DescriptorReader([DESCRIPTOR_TEST_DATA])
+
+ with reader:
+ for descriptor in reader:
+ print descriptor # TODO: change to be an automated check
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits