commit 1e9f2316859825343ae2ae2f28b6fd5ff2b4266b Author: Arturo Filastò arturo@filasto.net Date: Sat Mar 26 19:48:00 2016 +0100
Add test for YAML based reporter --- ooni/tests/test_reporter.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/ooni/tests/test_reporter.py b/ooni/tests/test_reporter.py index 94192ee..9774449 100644 --- a/ooni/tests/test_reporter.py +++ b/ooni/tests/test_reporter.py @@ -36,6 +36,13 @@ oonib_new_report_message = { 'supported_formats': ["yaml", "json"] }
+# This is used for testing legacy collectors +oonib_new_report_yaml_message = { + 'report_id': "20140129T202038Z_AS0_" + "A" * 50, + 'backend_version': "1.0" +} + + oonib_generic_error_message = { 'error': 'generic-error' } @@ -103,6 +110,13 @@ class TestOONIBReporter(unittest.TestCase): yield self.oonib_reporter.writeReportEntry(req) assert self.oonib_reporter.agent.request.called
+ @defer.inlineCallbacks + def test_write_report_entry_in_yaml(self): + self.mock_response = oonib_new_report_yaml_message + yield self.oonib_reporter.createReport() + req = {'content': 'something'} + yield self.oonib_reporter.writeReportEntry(req) + assert self.oonib_reporter.agent.request.called
class TestOONIBReportLog(unittest.TestCase):
tor-commits@lists.torproject.org