[Pkg-mozext-commits] [requestpolicy] 144/257: [tst][add] test "link to oldrules" exists

David Prévot taffit at moszumanska.debian.org
Thu Jan 28 03:20:06 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 2a2059f8c1c70af14aad59734d2dd860df78d2be
Author: Martin Kimmerle <dev at 256k.de>
Date:   Tue Nov 17 17:15:09 2015 +0100

    [tst][add] test "link to oldrules" exists
---
 tests/marionette/tests/manifest.ini                |  1 +
 tests/marionette/tests/settings/manifest.ini       |  1 +
 .../marionette/tests/settings/test_your_policy.py  | 45 ++++++++++++++++++++++
 3 files changed, 47 insertions(+)

diff --git a/tests/marionette/tests/manifest.ini b/tests/marionette/tests/manifest.ini
index 120286d..a6ea341 100644
--- a/tests/marionette/tests/manifest.ini
+++ b/tests/marionette/tests/manifest.ini
@@ -2,4 +2,5 @@
 [include:links/manifest.ini]
 [include:policy/manifest.ini]
 [include:redirections/manifest.ini]
+[include:settings/manifest.ini]
 [test_setup_page.py]
diff --git a/tests/marionette/tests/settings/manifest.ini b/tests/marionette/tests/settings/manifest.ini
new file mode 100644
index 0000000..82b2450
--- /dev/null
+++ b/tests/marionette/tests/settings/manifest.ini
@@ -0,0 +1 @@
+[test_your_policy.py]
diff --git a/tests/marionette/tests/settings/test_your_policy.py b/tests/marionette/tests/settings/test_your_policy.py
new file mode 100644
index 0000000..c5c58b1
--- /dev/null
+++ b/tests/marionette/tests/settings/test_your_policy.py
@@ -0,0 +1,45 @@
+# 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 import RequestPolicyTestCase
+from marionette_driver.errors import NoSuchElementException
+from rp_ui_harness.test_data.rules import ExemplaryOldRules
+
+
+class TestYourPolicy(RequestPolicyTestCase):
+
+    def setUp(self):
+        super(TestYourPolicy, self).setUp()
+
+        self.marionette.set_context("content")
+        self.settings.your_policy.open()
+
+    def tearDown(self):
+        try:
+            self.marionette.set_context("chrome")
+        finally:
+            super(TestYourPolicy, self).tearDown()
+
+    def test_link_to_oldrules(self):
+        def assert_visibility(should_be_displayed):
+            try:
+                link = (self.marionette
+                        .find_element("css selector",
+                                      "a[href='about:requestpolicy?oldrules']"))
+                self.assertEqual(link.is_displayed(), should_be_displayed)
+            except NoSuchElementException:
+                if should_be_displayed:
+                    self.fail("The link should exist.")
+
+        # Add old rules.
+        typical_rules = (ExemplaryOldRules(lambda: self.marionette)
+                         .typical_rules)
+        self.prefs.old_rules.set_rules(typical_rules["v0"])
+        self.settings.your_policy.open()
+        assert_visibility(True)
+
+        # Remove the rules.
+        self.prefs.old_rules.remove_all_prefs()
+        self.settings.your_policy.open()
+        assert_visibility(False)

-- 
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