def test_init(self): a = refpolicy.TypeRule() self.assertEqual(a.rule_type, a.TYPE_TRANSITION) self.assertTrue(isinstance(a.src_types, set)) self.assertTrue(isinstance(a.tgt_types, set)) self.assertTrue(isinstance(a.obj_classes, set)) self.assertEqual(a.dest_type, "")
def test_to_string(self): a = refpolicy.TypeRule() a.src_types.add("foo_t") a.tgt_types.add("bar_exec_t") a.obj_classes.add("process") a.dest_type = "bar_t" self.assertEqual(a.to_string(), "type_transition foo_t bar_exec_t:process bar_t;")