示例#1
0
    def test_000_unset(self):
        """Bounds query with no criteria."""
        # query with no parameters gets all bounds.
        allbounds = sorted(self.p.bounds())

        q = BoundsQuery(self.p)
        qbounds = sorted(q.results())

        self.assertListEqual(allbounds, qbounds)
示例#2
0
    def test_000_unset(self):
        """Bounds query with no criteria."""
        # query with no parameters gets all bounds.
        allbounds = sorted(self.p.bounds())

        q = BoundsQuery(self.p)
        qbounds = sorted(q.results())

        self.assertListEqual(allbounds, qbounds)
示例#3
0
    def test_010_child_exact(self):
        """Bounds query with exact child match."""
        q = BoundsQuery(self.p, child="test10_child", child_regex=False)
        qbounds = sorted(q.results())
        self.assertEqual(1, len(qbounds))

        b = qbounds[0]
        self.assertEqual("typebounds", b.ruletype)
        self.assertEqual("test10_parent", b.parent)
        self.assertEqual("test10_child", b.child)
示例#4
0
    def test_010_child_exact(self):
        """Bounds query with exact child match."""
        q = BoundsQuery(self.p, child="test10_child", child_regex=False)
        qbounds = sorted(q.results())
        self.assertEqual(1, len(qbounds))

        b = qbounds[0]
        self.assertEqual(BoundsRuletype.typebounds, b.ruletype)
        self.assertEqual("test10_parent", b.parent)
        self.assertEqual("test10_child", b.child)
示例#5
0
    def test_001_parent_exact(self):
        """Bounds query with exact parent match."""
        q = BoundsQuery(self.p, parent="test1_parent", parent_regex=False)
        qbounds = sorted(q.results())
        self.assertEqual(1, len(qbounds))

        b = qbounds[0]
        self.assertEqual(BoundsRuletype.typebounds, b.ruletype)
        self.assertEqual("test1_parent", b.parent)
        self.assertEqual("test1_child", b.child)
示例#6
0
    def test_001_parent_exact(self):
        """Bounds query with exact parent match."""
        q = BoundsQuery(self.p, parent="test1_parent", parent_regex=False)
        qbounds = sorted(q.results())
        self.assertEqual(1, len(qbounds))

        b = qbounds[0]
        self.assertEqual("typebounds", b.ruletype)
        self.assertEqual("test1_parent", b.parent)
        self.assertEqual("test1_child", b.child)
示例#7
0
    def test_011_child_regex(self):
        """Bounds query with regex child match."""
        q = BoundsQuery(self.p, child="test11_child?", child_regex=True)
        qbounds = sorted(q.results())
        self.assertEqual(2, len(qbounds))

        b = qbounds[0]
        self.assertEqual("typebounds", b.ruletype)
        self.assertEqual("test11_parent1", b.parent)
        self.assertEqual("test11_child2", b.child)

        b = qbounds[1]
        self.assertEqual("typebounds", b.ruletype)
        self.assertEqual("test11_parent2", b.parent)
        self.assertEqual("test11_child1", b.child)
示例#8
0
    def test_011_child_regex(self):
        """Bounds query with regex child match."""
        q = BoundsQuery(self.p, child="test11_child?", child_regex=True)
        qbounds = sorted(q.results())
        self.assertEqual(2, len(qbounds))

        b = qbounds[0]
        self.assertEqual(BoundsRuletype.typebounds, b.ruletype)
        self.assertEqual("test11_parent1", b.parent)
        self.assertEqual("test11_child2", b.child)

        b = qbounds[1]
        self.assertEqual(BoundsRuletype.typebounds, b.ruletype)
        self.assertEqual("test11_parent2", b.parent)
        self.assertEqual("test11_child1", b.child)
示例#9
0
    def test_002_parent_regex(self):
        """Bounds query with regex parent match."""
        q = BoundsQuery(self.p, parent="test2_parent?", parent_regex=True)
        qbounds = sorted(q.results())
        self.assertEqual(2, len(qbounds))

        b = qbounds[0]
        self.assertEqual(BoundsRuletype.typebounds, b.ruletype)
        self.assertEqual("test2_parent1", b.parent)
        self.assertEqual("test2_child2", b.child)

        b = qbounds[1]
        self.assertEqual(BoundsRuletype.typebounds, b.ruletype)
        self.assertEqual("test2_parent2", b.parent)
        self.assertEqual("test2_child1", b.child)
示例#10
0
    def test_002_parent_regex(self):
        """Bounds query with regex parent match."""
        q = BoundsQuery(self.p, parent="test2_parent?", parent_regex=True)
        qbounds = sorted(q.results())
        self.assertEqual(2, len(qbounds))

        b = qbounds[0]
        self.assertEqual("typebounds", b.ruletype)
        self.assertEqual("test2_parent1", b.parent)
        self.assertEqual("test2_child2", b.child)

        b = qbounds[1]
        self.assertEqual("typebounds", b.ruletype)
        self.assertEqual("test2_parent2", b.parent)
        self.assertEqual("test2_child1", b.child)
示例#11
0
 def __init__(self, parent, policy, perm_map):
     super(BoundsQueryTab, self).__init__(parent)
     self.log = logging.getLogger(__name__)
     self.policy = policy
     self.query = BoundsQuery(policy)
     self.setupUi()