Пример #1
0
    def test_021_perms_equal(self):
        """Constraint query with permission set equality match."""
        q = ConstraintQuery(self.p,
                            perms=["test21ap", "test21bp"],
                            perms_equal=True)

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test21c"], constraint)
Пример #2
0
    def test_000_unset(self):
        """Constraint query with no criteria."""
        allconstraint = sorted(c.tclass for c in self.p.constraints())

        q = ConstraintQuery(self.p)
        qconstraint = sorted(c.tclass for c in q.results())

        self.assertListEqual(allconstraint, qconstraint)
Пример #3
0
    def test_000_unset(self):
        """Constraint query with no criteria."""
        allconstraint = sorted(c.tclass for c in self.p.constraints())

        q = ConstraintQuery(self.p)
        qconstraint = sorted(c.tclass for c in q.results())

        self.assertListEqual(allconstraint, qconstraint)
Пример #4
0
    def test_041_type_match_regex(self):
        """Constraint query with regex type match."""
        q = ConstraintQuery(self.p, type_="test41t.", type_regex=True)

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test41a", "test41b"], constraint)
Пример #5
0
    def test_050_user_match_single(self):
        """Constraint query with user match."""
        q = ConstraintQuery(self.p, user="******")

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test50"], constraint)
Пример #6
0
    def test_031_role_match_regex(self):
        """Constraint query with regex role match."""
        q = ConstraintQuery(self.p, role="test31r.", role_regex=True)

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test31a", "test31b"], constraint)
Пример #7
0
    def test_012_class_list(self):
        """Constraint query with object class list match."""
        q = ConstraintQuery(self.p, tclass="test12(a|c)", tclass_regex=True)

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test12a", "test12c"], constraint)
Пример #8
0
    def test_010_class_exact(self):
        """Constraint query with exact object class match."""
        q = ConstraintQuery(self.p, tclass="test10")

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test10"], constraint)
Пример #9
0
    def test_012_class_list(self):
        """Constraint query with object class list match."""
        q = ConstraintQuery(self.p, tclass="test12(a|c)", tclass_regex=True)

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test12a", "test12c"], constraint)
Пример #10
0
    def test_011_class_list(self):
        """Constraint query with object class list match."""
        q = ConstraintQuery(self.p, tclass=["test11a", "test11b"])

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test11a", "test11b"], constraint)
Пример #11
0
    def test_010_class_exact(self):
        """Constraint query with exact object class match."""
        q = ConstraintQuery(self.p, tclass="test10")

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test10"], constraint)
Пример #12
0
    def test_001_ruletype(self):
        """Constraint query with rule type match."""
        q = ConstraintQuery(self.p, ruletype=["mlsconstrain"])

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test1"], constraint)
Пример #13
0
    def test_051_user_match_regex(self):
        """Constraint query with regex user match."""
        q = ConstraintQuery(self.p, user="******", user_regex=True)

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test51a", "test51b"], constraint)
Пример #14
0
    def test_050_user_match_single(self):
        """Constraint query with user match."""
        q = ConstraintQuery(self.p, user="******")

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test50"], constraint)
Пример #15
0
    def test_020_perms_any(self):
        """Constraint query with permission set intersection match."""
        q = ConstraintQuery(self.p, perms=["test20ap", "test20bp"])

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test20a", "test20b"], constraint)
Пример #16
0
    def test_051_user_match_regex(self):
        """Constraint query with regex user match."""
        q = ConstraintQuery(self.p, user="******", user_regex=True)

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test51a", "test51b"], constraint)
Пример #17
0
    def test_021_perms_equal(self):
        """Constraint query with permission set equality match."""
        q = ConstraintQuery(self.p, perms=["test21ap", "test21bp"], perms_equal=True)

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test21c"], constraint)
Пример #18
0
    def test_001_ruletype(self):
        """Constraint query with rule type match."""
        q = ConstraintQuery(self.p, ruletype=["mlsconstrain"])

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test1"], constraint)
Пример #19
0
    def test_030_role_match_single(self):
        """Constraint query with role match."""
        q = ConstraintQuery(self.p, role="test30r")

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test30"], constraint)
Пример #20
0
    def test_011_class_list(self):
        """Constraint query with object class list match."""
        q = ConstraintQuery(self.p, tclass=["test11a", "test11b"])

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test11a", "test11b"], constraint)
Пример #21
0
    def test_031_role_match_regex(self):
        """Constraint query with regex role match."""
        q = ConstraintQuery(self.p, role="test31r.", role_regex=True)

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test31a", "test31b"], constraint)
Пример #22
0
    def test_020_perms_any(self):
        """Constraint query with permission set intersection match."""
        q = ConstraintQuery(self.p, perms=["test20ap", "test20bp"])

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test20a", "test20b"], constraint)
Пример #23
0
    def test_040_type_match_single(self):
        """Constraint query with type match."""
        q = ConstraintQuery(self.p, type_="test40t")

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test40"], constraint)
Пример #24
0
    def test_030_role_match_single(self):
        """Constraint query with role match."""
        q = ConstraintQuery(self.p, role="test30r")

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test30"], constraint)
Пример #25
0
 def __init__(self, parent, policy, perm_map):
     super(ConstraintQueryTab, self).__init__(parent)
     self.log = logging.getLogger(__name__)
     self.policy = policy
     self.query = ConstraintQuery(policy)
     self.setupUi()
Пример #26
0
    def test_040_type_match_single(self):
        """Constraint query with type match."""
        q = ConstraintQuery(self.p, type_="test40t")

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test40"], constraint)
Пример #27
0
    def test_041_type_match_regex(self):
        """Constraint query with regex type match."""
        q = ConstraintQuery(self.p, type_="test41t.", type_regex=True)

        constraint = sorted(c.tclass for c in q.results())
        self.assertListEqual(["test41a", "test41b"], constraint)