[tor-commits] [oonib/master] Also test creating a report with the content key.

art at torproject.org art at torproject.org
Fri Aug 29 09:59:23 UTC 2014


commit ddc1b004be553972422d1e52a756225c0550a5c9
Author: Arturo Filastò <art at fuffa.org>
Date:   Fri Aug 29 11:33:21 2014 +0200

    Also test creating a report with the content key.
---
 oonib/test/test_report.py |   32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/oonib/test/test_report.py b/oonib/test/test_report.py
index 698b667..f9781f3 100644
--- a/oonib/test/test_report.py
+++ b/oonib/test/test_report.py
@@ -57,6 +57,21 @@ total: false
 ...
 """
 
+sample_report_header = """---
+input_hashes: []
+options: []
+probe_asn: AS0
+probe_cc: ZZ
+probe_city: null
+probe_ip: 127.0.0.1
+software_name: ooniprobe
+software_version: 1.1.0
+start_time: 0
+test_name: fake_test
+test_version: 0.1.0
+...
+"""
+
 for _, handler in reportAPI:
     handler.initialize = mock_initialize
 
@@ -74,6 +89,7 @@ class TestReport(HandlerTestCase):
             "POST", data)
         defer.returnValue(response)
 
+
     @defer.inlineCallbacks
     def test_create_valid_report(self):
         data = {
@@ -90,6 +106,22 @@ class TestReport(HandlerTestCase):
         self.filenames.add(response_body['report_id'])
 
     @defer.inlineCallbacks
+    def test_create_valid_report_with_content(self):
+        data = {
+            'software_name': 'ooni-test',
+            'software_version': '0.1',
+            'test_name': 'some-test',
+            'test_version': '0.1',
+            'probe_asn': 'AS0',
+            'content': sample_report_header
+        }
+        response = yield self.request('/report', "POST", data)
+        response_body = json.loads(response.body)
+        self.assertIn('backend_version', response_body)
+        self.assertIn('report_id', response_body)
+        self.filenames.add(response_body['report_id'])
+
+    @defer.inlineCallbacks
     def test_create_invalid_report(self):
         data = {
             'software_name': 'ooni-test',





More information about the tor-commits mailing list