def test_insert_after_rule(self): old_rule = PamdRule.rulefromstring('account required pam_unix.so') new_rule = PamdRule.rulefromstring('account required pam_permit.so arg1 arg2 arg3') insert_after_rule(self.pamd, old_rule, new_rule) line_to_test = str(old_rule).rstrip() line_to_test += '\n' line_to_test += str(new_rule).rstrip() self.assertIn(line_to_test, str(self.pamd))
def test_insert_after_rule_another(self): old_rule = PamdRule.rulefromstring('auth sufficient pam_rootok.so') new_rule = PamdRule.rulefromstring('auth required pam_wheel.so use_id') insert_after_rule(self.pamd, old_rule, new_rule) line_to_test = str(old_rule).rstrip() line_to_test += '\n' line_to_test += str(new_rule).rstrip() self.assertIn(line_to_test, str(self.pamd))
def test_insert_after_rule_another(self): old_rule = PamdRule.rulefromstring('auth sufficient pam_rootok.so') new_rule = PamdRule.rulefromstring( 'auth required pam_wheel.so use_id') insert_after_rule(self.pamd, old_rule, new_rule) line_to_test = str(old_rule).rstrip() line_to_test += '\n' line_to_test += str(new_rule).rstrip() self.assertIn(line_to_test, str(self.pamd))