test/test_asl_usermod.rb in activesambaldap-0.0.3 vs test/test_asl_usermod.rb in activesambaldap-0.0.4
- old
+ new
@@ -7,11 +7,11 @@
super
@command = File.join(@bin_dir, "asl-usermod")
end
def test_not_exist_user
- assert_equal([false, "", "user 'not-exist' doesn't exist.\n"],
+ assert_equal([false, "", _("user doesn't exist: %s") % 'not-exist' + "\n"],
run_command("not-exist"))
end
def test_gecos
make_dummy_user do |user, password|
@@ -104,11 +104,11 @@
old_samba_sid = user.samba_sid
old_rid = (2 * Integer(old_uid_number) + 1000).to_s
new_rid = (2 * Integer(new_uid_number) + 1000).to_s
new_samba_sid = old_samba_sid.sub(/#{Regexp.escape(old_rid)}$/, new_rid)
- message = "uid number '#{new_uid_number}' already exists\n"
+ message = _("uid number already exists: %s") % new_uid_number + "\n"
args = ["--uid", new_uid_number]
assert_asl_usermod_failed(user.uid, password, message, *args)
new_user = @user_class.find(user.uid)
assert_equal(old_uid_number, new_user.uid_number)
@@ -161,11 +161,11 @@
new_gid_number = group.gid_number
old_samba_primary_group_sid = user.samba_primary_group_sid
group.destroy
args = ["--gid", new_gid_number]
- message = "gid number '#{new_gid_number}' doesn't exist\n"
+ message = _("gid number doesn't exist: %s") % new_gid_number + "\n"
assert_asl_usermod_failed(user.uid, password, message, *args)
new_user = @user_class.find(user.uid)
assert_equal(old_gid_number, new_user.gid_number)
assert_equal(old_samba_primary_group_sid,
@@ -268,11 +268,11 @@
old_groups = @group_class.find(:all,
:attribute => "memberUid",
:value => user.uid)
args = ["--groups", new_gid_numbers.join(",")]
- message = "gid number '#{new_gid_numbers[0]}' doesn't exist\n"
+ message = _("gid number doesn't exist: %s") % new_gid_numbers[0] + "\n"
assert_asl_usermod_failed(user.uid, password, message, *args)
new_user = @user_class.find(user.uid)
new_groups = @group_class.find(:all,
:attribute => "memberUid",
@@ -297,16 +297,16 @@
new_user = @user_class.find(user.uid)
assert_equal(new_shell, new_user.login_shell)
end
end
- def test_canonical_name
+ def test_common_name
make_dummy_user do |user, password|
old_cn = user.cn
new_cn = "new-#{new_cn}"
- args = ["--canonical-name", new_cn]
+ args = ["--common-name", new_cn]
assert_asl_usermod_successfully(user.uid, password, *args)
new_user = @user_class.find(user.uid)
assert_equal(new_cn, new_user.cn)
end
@@ -521,19 +521,19 @@
end
private
def assert_asl_usermod_successfully(name, password, *args)
args << name
- assert_equal([true, "Enter your password: \n", ""],
+ assert_equal([true, _("Enter your password: ") + "\n", ""],
run_command_as_normal_user(*args) do |input, output|
output.puts password
output.puts password
end)
end
def assert_asl_usermod_failed(name, password, message, *args)
args << name
- assert_equal([false, "Enter your password: \n", message],
+ assert_equal([false, _("Enter your password: ") + "\n", message],
run_command_as_normal_user(*args) do |input, output|
output.puts password
output.puts password
end)
end