diff --git a/test/models/api_user_test.rb b/test/models/api_user_test.rb index 525e6c264..ec53d2371 100644 --- a/test/models/api_user_test.rb +++ b/test/models/api_user_test.rb @@ -22,9 +22,26 @@ class ApiUserTest < ActiveSupport::TestCase assert another_user.invalid? another_user.username = 'another' + another_user.identity_code = '' assert another_user.valid? end + def test_invalid_when_one_registrar_and_identity_code_is_already_taken + user = valid_user + another_user = user.dup + + assert another_user.invalid? + + another_user.username = 'another' + assert another_user.invalid? + end + + def test_valid_when_another_registrar_and_identity_code_is_already_taken + another_user = valid_user + @user.identity_code = another_user.identity_code + assert @user.valid? + end + def test_invalid_without_password user = valid_user user.plain_text_password = ''