[tor-commits] [ooni-probe/master] Merge branch 'feature/report_completion'

art at torproject.org art at torproject.org
Thu Jun 26 13:58:11 UTC 2014


commit 7ad1374fc6d18f8797d230626a327ddd8a37c9df
Merge: e958dbb 80dc471
Author: Arturo Filastò <art at fuffa.org>
Date:   Thu Jun 26 12:32:43 2014 +0200

    Merge branch 'feature/report_completion'
    
    * feature/report_completion:
      Add tool for viewing the status of report submission and allow users to upload reports.
      Expand ReportLog class. Make the editing log more robust
      Better handling of OONIB report closing.
      Fix bug that lead to some reports not being submitted.
      Also record the PID of the process that created or failed to create the report.
      Improve readablity of output by removing some log messages.
      Implement system for keeping track of reports that have not been submitted.
      Start implementing report log for keeping track of which reports have been created and which have failed.
      Pep8 related fixes.
    
    Conflicts:
    	ooni/tests/test_nettest.py
    	ooni/tests/test_reporter.py

 bin/oonireport                            |   26 ++
 ooni/deck.py                              |   14 +-
 ooni/director.py                          |   47 +--
 ooni/errors.py                            |  123 +++++---
 ooni/managers.py                          |   26 +-
 ooni/nettest.py                           |  130 +++++----
 ooni/nettests/blocking/dns_consistency.py |    7 +-
 ooni/oonicli.py                           |   98 +++----
 ooni/report/__init__.py                   |    1 +
 ooni/report/cli.py                        |   57 ++++
 ooni/report/parser.py                     |   35 +++
 ooni/report/tool.py                       |   73 +++++
 ooni/reporter.py                          |  446 +++++++++++++++++++----------
 ooni/settings.py                          |    2 +
 ooni/tasks.py                             |   26 +-
 ooni/tests/test_nettest.py                |   20 +-
 ooni/tests/test_reporter.py               |   72 ++++-
 17 files changed, 833 insertions(+), 370 deletions(-)

diff --cc ooni/tests/test_nettest.py
index 4ef6a55,6a550d6..94db4b3
--- a/ooni/tests/test_nettest.py
+++ b/ooni/tests/test_nettest.py
@@@ -8,18 -6,11 +6,13 @@@ from twisted.internet import defer, rea
  from twisted.python.usage import UsageError
  
  from ooni.settings import config
- from ooni.errors import MissingRequiredOption, InvalidOption, FailureToLoadNetTest
+ from ooni.errors import MissingRequiredOption
  from ooni.nettest import NetTest, NetTestLoader
- from ooni.tasks import BaseTask
  
  from ooni.director import Director
- from ooni.managers import TaskManager
  
- from ooni.tests.mocks import MockMeasurement, MockMeasurementFailOnce
- from ooni.tests.mocks import MockNetTest, MockDirector, MockReporter
- from ooni.tests.mocks import MockMeasurementManager
 +from ooni.tests.bases import ConfigTestCase
 +
  net_test_string = """
  from twisted.python import usage
  from ooni.nettest import NetTestCase
@@@ -115,9 -105,8 +107,10 @@@ dummyInvalidOptions = {'cram': 'jam'
  dummyArgsWithRequiredOptions = ('--foo', 'moo', '--bar', 'baz')
  dummyRequiredOptions = {'foo': 'moo', 'bar': 'baz'}
  dummyArgsWithFile = ('--spam', 'notham', '--file', 'dummyInputFile.txt')
 +dummyInputFile = 'dummyInputFile.txt'
 +
  
+ 
  class TestNetTest(unittest.TestCase):
      timeout = 1
  
@@@ -272,7 -261,8 +265,8 @@@
              self.assertTrue(test_class.requiresRoot)
  
  
 -class TestNettestTimeout(unittest.TestCase):
 +class TestNettestTimeout(ConfigTestCase):
+ 
      @defer.inlineCallbacks
      def setUp(self):
          from twisted.internet.protocol import Protocol, Factory
diff --cc ooni/tests/test_reporter.py
index e643f9a,69d9775..a499eb3
--- a/ooni/tests/test_reporter.py
+++ b/ooni/tests/test_reporter.py
@@@ -7,11 -7,10 +8,11 @@@ from mock import MagicMoc
  from twisted.internet import defer
  from twisted.trial import unittest
  
- from ooni.utils.net import StringProducer
  from ooni import errors as e
- from ooni.reporter import YAMLReporter, OONIBReporter
+ from ooni.reporter import YAMLReporter, OONIBReporter, OONIBReportLog
+ 
  
 +
  class MockTest(object):
      _start_time = time.time()
      report = {'report_content': 'ham'}
@@@ -38,12 -36,9 +39,13 @@@ oonib_generic_error_message = 
  
  
  class TestYAMLReporter(unittest.TestCase):
+ 
      def setUp(self):
 -        pass
 +        self.filename = ""
 +
 +    def tearDown(self):
 +        if self.filename != "":
 +            os.remove(self.filename)
  
      def test_write_report(self):
          test = MockTest()
@@@ -78,9 -75,9 +83,10 @@@ class TestOONIBReporter(unittest.TestCa
          def deliverBody(body_receiver):
              body_receiver.dataReceived(json.dumps(self.mock_response))
              body_receiver.connectionLost(None)
 +
          self.mock_agent_response.deliverBody = deliverBody
-         self.oonib_reporter.agent.request.return_value = defer.succeed(self.mock_agent_response)
+         self.oonib_reporter.agent.request.return_value = defer.succeed(
+             self.mock_agent_response)
  
      @defer.inlineCallbacks
      def test_create_report(self):





More information about the tor-commits mailing list