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

[tor-commits] [ooni-probe/master] Add URL list test.



commit d0a1a85b77894c97696147b348c66ad809681efb
Author: Arturo Filastò <arturo@xxxxxxxxxxx>
Date:   Mon Nov 5 21:45:48 2012 +0100

    Add URL list test.
---
 nettests/core/url_list.py          |   23 +++++++++++++++++++++++
 nettests/examples/example_httpt.py |    9 +++------
 ooni/templates/httpt.py            |    4 ++--
 3 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/nettests/core/url_list.py b/nettests/core/url_list.py
new file mode 100644
index 0000000..a6ed269
--- /dev/null
+++ b/nettests/core/url_list.py
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+#
+# :authors: Arturo Filastò
+# :licence: see LICENSE
+
+from ooni.templates import httpt
+
+class URLList(httpt.HTTPTest):
+    name = "URL List"
+    author = "Arturo Filastò"
+    version = 0.1
+
+    inputFile = ['file', 'f', None, 'List of URLS to perform GET and POST requests to']
+
+    def test_get(self):
+        if self.input:
+            self.url = self.input
+        else:
+            raise Exception("No input specified")
+
+        return self.doRequest(self.url)
+
+
diff --git a/nettests/examples/example_httpt.py b/nettests/examples/example_httpt.py
index b113b23..e76aed4 100644
--- a/nettests/examples/example_httpt.py
+++ b/nettests/examples/example_httpt.py
@@ -3,7 +3,9 @@
 # :authors: Arturo Filastò
 # :licence: see LICENSE
 
+from ooni.utils import log
 from ooni.templates import httpt
+
 class ExampleHTTP(httpt.HTTPTest):
     name = "Example HTTP Test"
     author = "Arturo Filastò"
@@ -30,10 +32,5 @@ class ExampleHTTP(httpt.HTTPTest):
     def processResponseHeaders(self, headers):
         # XXX place in here all the logic for handling the processing of HTTP
         #     Headers.
-        if headers.hasHeader('location'):
-            self.report['redirect'] = True
-
-        server = headers.getRawHeaders("Server")
-        if server:
-            self.report['http_server'] = str(server.pop())
+        pass
 
diff --git a/ooni/templates/httpt.py b/ooni/templates/httpt.py
index 2e2d9e1..5c7d552 100644
--- a/ooni/templates/httpt.py
+++ b/ooni/templates/httpt.py
@@ -159,8 +159,8 @@ class HTTPTest(NetTestCase):
             self.report['error'] = e
 
         def errback(data):
-            print data
-            #self.report["error"] = data
+            log.err("Error in test %s" % data)
+            self.report["error"] = data
 
         def finished(data):
             return

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