Пример #1
0
    def test_000_unset(self):
        """Default query: no criteria."""
        # query with no parameters gets all defaults
        alldefaults = sorted(self.p.defaults())

        q = DefaultQuery(self.p)
        qdefaults = sorted(q.results())

        self.assertListEqual(alldefaults, qdefaults)
Пример #2
0
    def test_000_unset(self):
        """Default query: no criteria."""
        # query with no parameters gets all defaults
        alldefaults = sorted(self.p.defaults())

        q = DefaultQuery(self.p)
        qdefaults = sorted(q.results())

        self.assertListEqual(alldefaults, qdefaults)
Пример #3
0
    def test_001_ruletype(self):
        """Default query: ruletype criterion."""
        q = DefaultQuery(self.p, ruletype=["default_user"])
        defaults = list(q.results())
        self.assertEqual(1, len(defaults))

        d = defaults[0]
        self.assertEqual(DefaultRuletype.default_user, d.ruletype)
        self.assertEqual("infoflow", d.tclass)
        self.assertEqual(DefaultValue.target, d.default)
Пример #4
0
    def test_001_ruletype(self):
        """Default query: ruletype criterion."""
        q = DefaultQuery(self.p, ruletype=["default_user"])
        defaults = list(q.results())
        self.assertEqual(1, len(defaults))

        d = defaults[0]
        self.assertEqual(DefaultRuletype.default_user, d.ruletype)
        self.assertEqual("infoflow", d.tclass)
        self.assertEqual(DefaultValue.target, d.default)
Пример #5
0
    def test_030_default_range(self):
        """Default query: default_range setting."""
        q = DefaultQuery(self.p, default_range="high")

        defaults = sorted(c.tclass for c in q.results())
        self.assertListEqual(["infoflow7"], defaults)
Пример #6
0
    def test_020_default(self):
        """Default query: default setting."""
        q = DefaultQuery(self.p, default="source")

        defaults = sorted(c.tclass for c in q.results())
        self.assertListEqual(["infoflow", "infoflow3"], defaults)
Пример #7
0
    def test_011_class_regex(self):
        """Default query: object class regex match."""
        q = DefaultQuery(self.p, tclass="infoflow(3|5)", tclass_regex=True)

        defaults = sorted(c.tclass for c in q.results())
        self.assertListEqual(["infoflow3", "infoflow5"], defaults)
Пример #8
0
    def test_010_class_list(self):
        """Default query: object class list match."""
        q = DefaultQuery(self.p, tclass=["infoflow3", "infoflow4"])

        defaults = sorted(d.tclass for d in q.results())
        self.assertListEqual(["infoflow3", "infoflow4"], defaults)
Пример #9
0
    def test_030_default_range(self):
        """Default query: default_range setting."""
        q = DefaultQuery(self.p, default_range="high")

        defaults = sorted(c.tclass for c in q.results())
        self.assertListEqual(["infoflow7"], defaults)
Пример #10
0
    def test_020_default(self):
        """Default query: default setting."""
        q = DefaultQuery(self.p, default="source")

        defaults = sorted(c.tclass for c in q.results())
        self.assertListEqual(["infoflow", "infoflow3"], defaults)
Пример #11
0
    def test_011_class_regex(self):
        """Default query: object class regex match."""
        q = DefaultQuery(self.p, tclass="infoflow(3|5)", tclass_regex=True)

        defaults = sorted(c.tclass for c in q.results())
        self.assertListEqual(["infoflow3", "infoflow5"], defaults)
Пример #12
0
    def test_010_class_list(self):
        """Default query: object class list match."""
        q = DefaultQuery(self.p, tclass=["infoflow3", "infoflow4"])

        defaults = sorted(d.tclass for d in q.results())
        self.assertListEqual(["infoflow3", "infoflow4"], defaults)