commit c8df2379870e9210c4fe20541b5f6ca4f65e1cbb Author: Arturo Filastò arturo@filasto.net Date: Mon May 23 13:12:36 2016 +0200
Ensure the input key is properly set
* Improve readability of the blockpage detection check --- ooni/nettests/blocking/web_connectivity.py | 8 +++++--- ooni/tasks.py | 5 ++--- 2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/ooni/nettests/blocking/web_connectivity.py b/ooni/nettests/blocking/web_connectivity.py index f68b5aa..4f5f4e4 100644 --- a/ooni/nettests/blocking/web_connectivity.py +++ b/ooni/nettests/blocking/web_connectivity.py @@ -355,9 +355,11 @@ class WebConnectivityTest(httpt.HTTPTest, dnst.DNSTest): self.report['dns_consistency'] = 'inconsistent' tcp_connect = self.compare_tcp_experiments()
- got_expected_web_page = (self.report['body_length_match'] or - self.report['headers_match']) and \ - self.report['status_code_match'] + got_expected_web_page = ( + (self.report['body_length_match'] is True or + self.report['headers_match'] is True) + and self.report['status_code_match'] is True + )
if (dns_consistent == True and tcp_connect == False and experiment_http_failure is not None): diff --git a/ooni/tasks.py b/ooni/tasks.py index 72e211f..925089b 100644 --- a/ooni/tasks.py +++ b/ooni/tasks.py @@ -113,10 +113,9 @@ class Measurement(TaskWithTimeout): if not hasattr(self.testInstance, '_start_time'): self.testInstance._start_time = time.time()
- if 'input' not in self.testInstance.report.keys(): - self.testInstance.report['input'] = test_input - self.testInstance.setUp() + if 'input' not in self.testInstance.report.keys(): + self.testInstance.report['input'] = self.testInstance.input
self.netTestMethod = getattr(self.testInstance, test_method)