[tor-commits] [ooni-probe/master] add/change report variable names

2016-04-29 Thread art
commit 1a38fe60ac1137e45b6dc1c8c038f7a2133f85d3
Author: juga0 
Date:   Thu Dec 24 13:42:34 2015 +

add/change report variable names
 * add bootstrapped_success report key with value true when the text 'Press 
Ctrl-C to terminate.' is found, false when psiphon runs but is not found and 
none when psiphon does not run
 * change success report key to request_success
 * keep psiphon_installed key, but change the name to psiphon_found
---
 ooni/nettests/third_party/psiphon.py | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/ooni/nettests/third_party/psiphon.py 
b/ooni/nettests/third_party/psiphon.py
index a25e955..bfdec70 100644
--- a/ooni/nettests/third_party/psiphon.py
+++ b/ooni/nettests/third_party/psiphon.py
@@ -82,17 +82,21 @@ connect(False)
 def handleRead(self, stdout, stderr):
 if 'Press Ctrl-C to terminate.' in self.processDirector.stdout:
 if not self.bootstrapped.called:
+# here the text 'Press Ctrl-C to terminate.' has been found
+# and it was to call doRequest
+self.report['bootstrapped_success'] = True
 log.debug("PsiphonTest: calling bootstrapped.callback")
 self.bootstrapped.callback(None)
 
 def test_psiphon(self):
 log.debug('PsiphonTest.test_psiphon')
 
-self.report['success'] = None
-self.report['psiphon_installed'] = None
+self.report['bootstrapped_success'] = None
+self.report['request_success'] = None
+self.report['psiphon_found'] = None
 if not os.path.exists(self.psiphonpath):
 log.err('psiphon path does not exists, is it installed?')
-self.report['psiphon_installed'] = False
+self.report['psiphon_found'] = False
 log.debug("Adding %s to report" % self.report)
 # XXX: the original code written by juga0 readed
 # > return defer.succeed(None)
@@ -103,7 +107,7 @@ connect(False)
 reactor.callLater(0.0, self.bootstrapped.callback, None)
 return self.bootstrapped
 
-self.report['psiphon_installed'] = True
+self.report['psiphon_found'] = True
 log.debug("Adding %s to report" % self.report)
 
 # Using pty to see output lines as soon as they get wrotten in the
@@ -114,18 +118,22 @@ connect(False)
 env=dict(PYTHONPATH=self.psiphonpath),
 path=self.psiphonpath,
 usePTY=1)
+# here psiphon command has been run, and if it finds the text
+# 'Press Ctrl-C to terminate' in handleRead it will write to the
+# report self.report['bootstrapped_success'] = True
+self.report['bootstrapped_success'] = False
 
 def callDoRequest(_):
 log.debug("PsiphonTest.callDoRequest: %r" %(_,))
 d = self.doRequest(self.url)
 def addSuccessToReport(res):
 log.debug("PsiphonTest.callDoRequest.addSuccessToReport")
-self.report['success'] = True
+self.report['request_success'] = True
 return res
 d.addCallback(addSuccessToReport)
 def addFailureToReport(res):
 log.debug("PsiphonTest.callDoRequest.addFailureToReport. 
res=%r" % (res,))
-self.report['success'] = False
+self.report['request_success'] = False
 return res
 d.addErrback(addFailureToReport)
 return d



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


[tor-commits] [ooni-probe/master] add/change report variable names

2016-01-30 Thread art
commit c9d1d950e76ccba69a3b7373b99e26be4b679ee9
Author: juga0 
Date:   Thu Dec 24 13:42:34 2015 +

add/change report variable names
 * add bootstrapped_success report key with value true when the text 'Press 
Ctrl-C to terminate.' is found, false when psiphon runs but is not found and 
none when psiphon does not run
 * change success report key to request_success
 * keep psiphon_installed key, but change the name to psiphon_found
---
 ooni/nettests/third_party/psiphon.py | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/ooni/nettests/third_party/psiphon.py 
b/ooni/nettests/third_party/psiphon.py
index a25e955..bfdec70 100644
--- a/ooni/nettests/third_party/psiphon.py
+++ b/ooni/nettests/third_party/psiphon.py
@@ -82,17 +82,21 @@ connect(False)
 def handleRead(self, stdout, stderr):
 if 'Press Ctrl-C to terminate.' in self.processDirector.stdout:
 if not self.bootstrapped.called:
+# here the text 'Press Ctrl-C to terminate.' has been found
+# and it was to call doRequest
+self.report['bootstrapped_success'] = True
 log.debug("PsiphonTest: calling bootstrapped.callback")
 self.bootstrapped.callback(None)
 
 def test_psiphon(self):
 log.debug('PsiphonTest.test_psiphon')
 
-self.report['success'] = None
-self.report['psiphon_installed'] = None
+self.report['bootstrapped_success'] = None
+self.report['request_success'] = None
+self.report['psiphon_found'] = None
 if not os.path.exists(self.psiphonpath):
 log.err('psiphon path does not exists, is it installed?')
-self.report['psiphon_installed'] = False
+self.report['psiphon_found'] = False
 log.debug("Adding %s to report" % self.report)
 # XXX: the original code written by juga0 readed
 # > return defer.succeed(None)
@@ -103,7 +107,7 @@ connect(False)
 reactor.callLater(0.0, self.bootstrapped.callback, None)
 return self.bootstrapped
 
-self.report['psiphon_installed'] = True
+self.report['psiphon_found'] = True
 log.debug("Adding %s to report" % self.report)
 
 # Using pty to see output lines as soon as they get wrotten in the
@@ -114,18 +118,22 @@ connect(False)
 env=dict(PYTHONPATH=self.psiphonpath),
 path=self.psiphonpath,
 usePTY=1)
+# here psiphon command has been run, and if it finds the text
+# 'Press Ctrl-C to terminate' in handleRead it will write to the
+# report self.report['bootstrapped_success'] = True
+self.report['bootstrapped_success'] = False
 
 def callDoRequest(_):
 log.debug("PsiphonTest.callDoRequest: %r" %(_,))
 d = self.doRequest(self.url)
 def addSuccessToReport(res):
 log.debug("PsiphonTest.callDoRequest.addSuccessToReport")
-self.report['success'] = True
+self.report['request_success'] = True
 return res
 d.addCallback(addSuccessToReport)
 def addFailureToReport(res):
 log.debug("PsiphonTest.callDoRequest.addFailureToReport. 
res=%r" % (res,))
-self.report['success'] = False
+self.report['request_success'] = False
 return res
 d.addErrback(addFailureToReport)
 return d



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