commit 510adaf6c473fb289aca6973b662f0a6cb2a53c9 Author: Arturo Filastò arturo@filasto.net Date: Thu Mar 24 13:50:53 2016 +0100
Add checks for input file and url in http_requests test --- ooni/nettests/blocking/http_requests.py | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/ooni/nettests/blocking/http_requests.py b/ooni/nettests/blocking/http_requests.py index e00b4c6..e2c9671 100644 --- a/ooni/nettests/blocking/http_requests.py +++ b/ooni/nettests/blocking/http_requests.py @@ -11,6 +11,8 @@ from ooni.utils.net import userAgents from ooni.templates import httpt from ooni.errors import failureToString
+class MissingInput(Exception): + pass
class UsageOptions(usage.Options): optParameters = [ @@ -50,6 +52,12 @@ class HTTPRequestsTest(httpt.HTTPTest): control_body_length = None experiment_body_length = None
+ def requirements(self): + if not self.localOptions['url'] and \ + not self.localOptions['file']: + raise MissingInput("You did not specify either a URL with -u " + "or an input file with -f") + def setUp(self): """ Check for inputs.
tor-commits@lists.torproject.org