[Pkg-mozext-commits] [requestpolicy] 73/257: [tst][add] Marionette test: URI without host

David Prévot taffit at moszumanska.debian.org
Thu Jan 28 03:19:58 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository requestpolicy.

commit dc31742c1bab08b55e2d916283b5702340c6e429
Author: Martin Kimmerle <dev at 256k.de>
Date:   Fri Oct 9 19:08:21 2015 +0200

    [tst][add] Marionette test: URI without host
    
    Convert Mozmill test "testRequestLog/testUriWithoutHost.js" to
    Marionette.
    
    The test is in fact not about the Request Log, more about such
    URIs in general, so the Marionette test uses the "Requests" API
    instead of the "RequestLog" UI library, which is faster.
---
 tests/marionette/tests/policy/manifest.ini |  1 +
 tests/marionette/tests/policy/test_uris.py | 47 ++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)

diff --git a/tests/marionette/tests/policy/manifest.ini b/tests/marionette/tests/policy/manifest.ini
index 40a1ea3..5ce7ba9 100644
--- a/tests/marionette/tests/policy/manifest.ini
+++ b/tests/marionette/tests/policy/manifest.ini
@@ -1 +1,2 @@
 [test_rule_with_scheme_only.py]
+[test_uris.py]
diff --git a/tests/marionette/tests/policy/test_uris.py b/tests/marionette/tests/policy/test_uris.py
new file mode 100644
index 0000000..529da77
--- /dev/null
+++ b/tests/marionette/tests/policy/test_uris.py
@@ -0,0 +1,47 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from rp_ui_harness.testcases import RequestPolicyTestCase
+
+
+class TestUris(RequestPolicyTestCase):
+    """Class for testing specific URI types."""
+
+    def setUp(self):
+        super(TestUris, self).setUp()
+
+        self.marionette.set_context("content")
+
+    def tearDown(self):
+        try:
+            self.requests.stop_listening()
+            self.marionette.set_context("chrome")
+        finally:
+            super(TestUris, self).tearDown()
+
+    def test_uri_without_host(self):
+        url = "http://www.maindomain.test/scheme-unknown-and-without-host.html"
+
+        self.requests.start_listening()
+
+        def get_requests_by_dest(dest_uri):
+            return [request
+                    for request in self.requests.all
+                    if request["dest"] == dest_uri]
+
+        with self.marionette.using_context("content"):
+            self.marionette.navigate(url)
+
+            link = self.marionette.find_element("tag name", "a")
+            link_uri = link.get_attribute("href")
+
+        self.assertEqual(len(get_requests_by_dest(link_uri)), 0,
+                         ("There hasn't been any request to '{}' yet."
+                          .format(link_uri)))
+
+        link.click()
+
+        self.assertEqual(len(get_requests_by_dest(link_uri)), 1,
+                         ("There has been exactly one request to '{}'."
+                          .format(link_uri)))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git



More information about the Pkg-mozext-commits mailing list