def test_add_module_arguments_where_none_existed(self): old_rule = PamdRule.rulefromstring('account required pam_unix.so') new_rule = PamdRule.rulefromstring( 'account required pam_unix.so arg1 arg2= arg3=arg3') args_to_add = ['arg1', 'arg2=', 'arg3=arg3'] add_module_arguments(self.pamd, old_rule, args_to_add) self.assertIn(str(new_rule).rstrip(), str(self.pamd))
def test_add_module_args_with_string(self): old_rule = PamdRule.rulefromstring( "account required pam_access.so") new_rule = PamdRule.rulefromstring( "account required pam_access.so listsep=,") args_to_add = ['listsep=,'] add_module_arguments(self.pamd, old_rule, args_to_add) self.assertIn(str(new_rule).rstrip(), str(self.pamd))
def test_add_module_arguments_where_some_existed(self): old_rule = PamdRule.rulefromstring( 'auth sufficient pam_unix.so nullok try_first_pass') new_rule = PamdRule.rulefromstring( 'auth sufficient pam_unix.so nullok try_first_pass arg1 arg2= arg3=arg3' ) args_to_add = ['arg1', 'arg2=', 'arg3=arg3'] add_module_arguments(self.pamd, old_rule, args_to_add) self.assertIn(str(new_rule).rstrip(), str(self.pamd))
def test_add_module_arguments_where_some_existed(self): old_rule = PamdRule.rulefromstring('auth sufficient pam_unix.so nullok try_first_pass') new_rule = PamdRule.rulefromstring('auth sufficient pam_unix.so nullok try_first_pass arg1 arg2= arg3=arg3') args_to_add = ['arg1', 'arg2=', 'arg3=arg3'] add_module_arguments(self.pamd, old_rule, args_to_add) self.assertIn(str(new_rule).rstrip(), str(self.pamd))
def test_add_module_arguments_where_none_existed(self): old_rule = PamdRule.rulefromstring('account required pam_unix.so') new_rule = PamdRule.rulefromstring('account required pam_unix.so arg1 arg2= arg3=arg3') args_to_add = ['arg1', 'arg2=', 'arg3=arg3'] add_module_arguments(self.pamd, old_rule, args_to_add) self.assertIn(str(new_rule).rstrip(), str(self.pamd))
def test_add_module_args_with_string(self): old_rule = PamdRule.rulefromstring("account required pam_access.so") new_rule = PamdRule.rulefromstring("account required pam_access.so listsep=,") args_to_add = ['listsep=,'] add_module_arguments(self.pamd, old_rule, args_to_add) self.assertIn(str(new_rule).rstrip(), str(self.pamd))