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

[tor-commits] [ooni-probe/master] Use usageOptions in HTTP requests test



commit d3985c82de5537b4452838bd09bc28ca8758f69f
Author: Arturo Filastò <art@xxxxxxxxx>
Date:   Thu Nov 22 11:24:45 2012 +0100

    Use usageOptions in HTTP requests test
---
 nettests/core/http_requests.py |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/nettests/core/http_requests.py b/nettests/core/http_requests.py
index 0315145..7a2f5ef 100644
--- a/nettests/core/http_requests.py
+++ b/nettests/core/http_requests.py
@@ -6,6 +6,8 @@
 import random
 import json
 
+from twisted.python import usage
+
 from ooni.utils import log, net
 from ooni.templates import httpt
 
@@ -19,6 +21,14 @@ def random_capitalization(string):
             output += string[i]
     return output
 
+class UsageOptions(usage.Options):
+    optParameters = [
+            ['backend', 'b', None, 
+                'URL of the backend to use for sending the requests'],
+            ['headers', 'h', None,
+                'Specify a yaml formatted file from which to read the request headers to send']
+            ]
+
 class HTTPRequests(httpt.HTTPTest):
     """
     This test is also known as Header Field manipulation. It performes HTTP
@@ -28,12 +38,7 @@ class HTTPRequests(httpt.HTTPTest):
     author = "Arturo Filastò"
     version = 0.1
 
-    optParameters = [
-            ['backend', 'b', None, 
-                'URL of the backend to use for sending the requests'],
-            ['headers', 'h', None,
-                'Specify a yaml formatted file from which to read the request headers to send']
-            ]
+    usageOptions = UsageOptions
 
     requiredOptions = ['backend']
 



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