def testProcessTypeLine(self): type_policy = SELinuxPolicy() test_normal_string = 'type TEST_type, TEST_att1, TEST_att2;' test_type = 'TEST_type' test_atts = ['TEST_att1', 'TEST_att2'] #test with 'normal input' type_policy.process_type_line(test_normal_string) self.failUnless(test_type in type_policy.types) for a in test_atts: self.failUnless(a in type_policy.attributes) self.failUnless(test_type in type_policy.attributes[a])
def testProcessTypeattributeLine(self): typ_att_policy = SELinuxPolicy() test_normal_string = 'typeattribute TEST_type TEST_att1, TEST_att2;' test_type = 'TEST_type' test_atts = ['TEST_att1', 'TEST_att2'] #test with 'normal input' (type should already be declared) typ_att_policy.process_type_line('type ' + test_type + ';') typ_att_policy.process_typeattribute_line(test_normal_string) self.failUnless(test_type in typ_att_policy.types) for a in test_atts: self.failUnless(a in typ_att_policy.attributes) self.failUnless(test_type in typ_att_policy.attributes[a])