[Pkg-mozext-commits] [requestpolicy] 141/257: [tst][ref] TestRuleRow: merge `origin` and `dest` test functions
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 609f8b469c7bcee52ece6e423d69431815916400
Author: Martin Kimmerle <dev at 256k.de>
Date: Tue Nov 17 15:12:12 2015 +0100
[tst][ref] TestRuleRow: merge `origin` and `dest` test functions
Merge `test_origin_property()` and `def test_dest_property()`
into `test_origin_and_dest_properties()`.
In the same step the two private methods have been moved into
the new function.
---
.../rp_puppeteer/tests/test_rules_table.py | 67 +++++++++++-----------
1 file changed, 32 insertions(+), 35 deletions(-)
diff --git a/tests/marionette/rp_puppeteer/tests/test_rules_table.py b/tests/marionette/rp_puppeteer/tests/test_rules_table.py
index 18262fb..537350f 100644
--- a/tests/marionette/rp_puppeteer/tests/test_rules_table.py
+++ b/tests/marionette/rp_puppeteer/tests/test_rules_table.py
@@ -124,45 +124,42 @@ class TestRuleRow(RulesTableTestCase):
# Test using a rule with "deny" policy.
test_rule(self.data.deny_rule, "block")
- def _test_endpoint(self, endpoint):
- assert endpoint in ["origin", "dest"]
-
- def test(spec_id):
- self._test_pre_path_spec(endpoint,
- self.data.pre_path_specs[spec_id])
-
- test("s")
- test("h")
- test("p")
- test("sh")
- test("sp")
- test("hp")
- test("shp")
-
- def _test_pre_path_spec(self, endpoint, spec):
- def create_rule():
- """Create the rule from the spec info."""
- endpoint_short = "o" if endpoint == "origin" else "d"
- rule_data = {endpoint_short: spec["spec"]}
- return self.rules.create_rule(rule_data, allow=True)
-
- # Create and add the rule.
- rule = create_rule()
- rule.add()
+ def test_origin_and_dest_properties(self):
+ def test_pre_path_spec(endpoint, spec):
+ def create_rule():
+ """Create the rule from the spec info."""
+ endpoint_short = "o" if endpoint == "origin" else "d"
+ rule_data = {endpoint_short: spec["spec"]}
+ return self.rules.create_rule(rule_data, allow=True)
+
+ # Create and add the rule.
+ rule = create_rule()
+ rule.add()
- # Check if the cell text matches the expected string.
- rule_row = self.table.user_rule_rows[0]
- returned_string = getattr(rule_row, endpoint)
- self.assertEqual(returned_string, spec["expected_string"])
+ # Check if the cell text matches the expected string.
+ rule_row = self.table.user_rule_rows[0]
+ returned_string = getattr(rule_row, endpoint)
+ self.assertEqual(returned_string, spec["expected_string"])
- # Remove the rule again.
- rule.remove()
+ # Remove the rule again.
+ rule.remove()
+
+ def test_endpoint(endpoint):
+ assert endpoint in ["origin", "dest"]
+
+ def test(spec_id):
+ test_pre_path_spec(endpoint, self.data.pre_path_specs[spec_id])
- def test_origin_property(self):
- self._test_endpoint("origin")
+ test("s")
+ test("h")
+ test("p")
+ test("sh")
+ test("sp")
+ test("hp")
+ test("shp")
- def test_dest_property(self):
- self._test_endpoint("dest")
+ test_endpoint("origin")
+ test_endpoint("dest")
def test_origin_empty(self):
self.data.rule_without_origin.add()
--
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