More fixed tests

This commit is contained in:
Jyri-Petteri Paloposki 2020-07-20 20:25:35 +03:00
parent efee4976b0
commit 149dbe7e27
4 changed files with 16 additions and 15 deletions

View file

@ -18,7 +18,7 @@ class UsersControllerTest < ActionController::TestCase
get :index
assert_response :success
assert_equal "TRACKS::Manage Users", assigns['page_title']
assert_equal 4, assigns['total_users']
assert_equal 5, assigns['total_users']
assert_equal users_url, session['return-to']
end

View file

@ -19,17 +19,6 @@ other_user:
last_name: Doe
auth_type: database
other_user_email:
id: 3
login: joe
crypted_password: <%= BCrypt::Password.create("open") %>
token: <%= Digest::SHA1.hexdigest("joeSun Feb 19 14:42:45 GMT 20060.408173979260027") %>
is_admin: false
first_name: Jane
last_name: Doe
email: joe@example.org
auth_type: database
ldap_user:
id: 3
login: john
@ -59,3 +48,15 @@ ldap_user:
first_name: International
last_name: Harvester
auth_type: CAS
other_user_email:
id: 6
login: joe
crypted_password: <%= BCrypt::Password.create("open") %>
token: <%= Digest::SHA1.hexdigest("joeSun Feb 19 14:42:45 GMT 20060.408173979260027") %>
is_admin: false
first_name: Jane
last_name: Doe
email: joe@example.org
auth_type: database

View file

@ -71,7 +71,7 @@ class UsersXmlApiTest < ActionDispatch::IntegrationTest
end
barracuda1 = User.where(:login => 'barracuda').first
assert_not_nil barracuda1, "expected user barracuda to be created"
johnny2 = User.authenticate('barracuda','johnny')
barracuda2 = User.authenticate('barracuda','johnny')
assert_not_nil barracuda2, "expected user barracuda to be authenticated"
end
@ -83,7 +83,7 @@ class UsersXmlApiTest < ActionDispatch::IntegrationTest
get '/users.xml', params: {}, headers: basic_auth_headers()
assert_response :success
assert_select 'users' do
assert_select 'user', count: 4
assert_select 'user', count: 5
end
assert_select 'password', false
end

View file

@ -98,7 +98,7 @@ class UserTest < ActiveSupport::TestCase
def test_validate_email_format
assert_no_difference 'User.count' do
u = create_user :email=> 'test'
assert_equal "is not valid", u.errors[:email]
assert_equal ["is not valid"], u.errors[:email]
end
end