[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] Add keyword filtering test file



commit 71cb3d71443dc1b28a4aa62dcd0b880e2b5f5cac
Author: Arturo Filastò <arturo@xxxxxxxxxxx>
Date:   Tue Nov 6 13:53:38 2012 +0100

    Add keyword filtering test file
---
 nettests/core/keyword_filtering.py |   39 ++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/nettests/core/keyword_filtering.py b/nettests/core/keyword_filtering.py
new file mode 100644
index 0000000..26af327
--- /dev/null
+++ b/nettests/core/keyword_filtering.py
@@ -0,0 +1,39 @@
+# -*- encoding: utf-8 -*-
+#
+# :authors: Arturo Filastò
+# :licence: see LICENSE
+
+from ooni.templates import httpt
+class KeywordFiltering(httpt.HTTPTest):
+    """
+    This test involves performing HTTP requests containing to be tested for
+    censorship keywords.
+    """
+    name = "Keyword Filtering"
+    author = "Arturo Filastò"
+    version = 0.1
+
+    optParameters = [['backend', 'b', None, 'URL of the backend system to use for testing']]
+
+    inputFile = ['file', 'f', None, 'List of keywords to use for censorship testing']
+
+    def processInputs(self):
+        if 'backend' in self.localOptions:
+            self.url = self.localOptions['backend']
+        else:
+            raise Exception("No backend specified")
+
+    def test_get(self):
+        """
+        Perform a HTTP GET request to the backend containing the keyword to be
+        tested inside of the request body.
+        """
+        return self.doRequest(self.url, method="GET", body=self.input)
+
+    def test_post(self):
+        """
+        Perform a HTTP POST request to the backend containing the keyword to be
+        tested inside of the request body.
+        """
+        return self.doRequest(self.url, method="POST", body=self.input)
+

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