Integrate master branch

This commit is contained in:
Artur Beljajev 2018-08-08 19:36:14 +03:00
parent bf3b54367b
commit 6de31605d9
8 changed files with 9 additions and 9 deletions

View file

@ -1,25 +0,0 @@
require 'test_helper'
class AdminAreaNewApiUserTest < ActionDispatch::IntegrationTest
setup do
sign_in users(:admin)
end
def test_new_api_user_creation_with_required_params
visit admin_api_users_url
click_link_or_button 'New API user'
fill_in 'Username', with: 'newtest'
fill_in 'Password', with: 'testtest'
find('#api_user_registrar_id', visible: false).set(registrars(:bestnames).id)
assert_difference 'ApiUser.count' do
click_link_or_button 'Save'
end
assert_current_path admin_api_user_path(ApiUser.last)
assert_text 'Record created'
assert_text 'Username newtest'
assert_text 'Password testtest'
end
end

View file

@ -1,44 +0,0 @@
require 'test_helper'
class AdminAreaLoginTest < ActionDispatch::IntegrationTest
def setup
@user = users(:admin)
end
def test_correct_username_and_password
visit new_admin_user_session_url
fill_in 'admin_user_username', with: @user.username
fill_in 'admin_user_password', with: 'testtest'
click_button 'Sign in'
assert_text 'Signed in successfully'
assert_current_path admin_root_path
end
def test_wrong_password
visit new_admin_user_session_url
fill_in 'admin_user_username', with: @user.username
fill_in 'admin_user_password', with: 'wrong'
click_button 'Sign in'
assert_text 'Invalid Username or password'
assert_current_path new_admin_user_session_path
end
def test_retry_with_correct_username_and_password
visit new_admin_user_session_url
fill_in 'admin_user_username', with: @user.username
fill_in 'admin_user_password', with: 'wrong'
click_button 'Sign in'
assert_text 'Invalid Username or password'
assert_current_path new_admin_user_session_path
fill_in 'admin_user_username', with: @user.username
fill_in 'admin_user_password', with: 'testtest'
click_button 'Sign in'
assert_text 'Signed in successfully'
assert_current_path admin_root_path
end
end

View file

@ -1,15 +0,0 @@
require 'test_helper'
class AdminAreaLogoutTest < ActionDispatch::IntegrationTest
def setup
sign_in users(:admin)
end
def test_logout
visit admin_root_url
click_on 'Sign out'
assert_text 'Signed out successfully'
assert_current_path new_admin_user_session_path
end
end

View file

@ -1,22 +0,0 @@
require 'test_helper'
class AdminAreaProtectedAreaTest < ActionDispatch::IntegrationTest
def test_anonymous_user_is_asked_to_authenticate_when_navigating_to_protected_area
visit admin_domains_url
assert_text 'You need to sign in before continuing'
assert_current_path new_admin_user_session_path
end
def test_authenticated_user_can_access_protected_area
sign_in users(:admin)
visit admin_domains_url
assert_current_path admin_domains_path
end
def test_authenticated_user_is_not_asked_to_authenticate_again
sign_in users(:admin)
visit new_admin_user_session_url
assert_text 'You are already signed in'
assert_current_path admin_root_path
end
end

View file

@ -1,39 +0,0 @@
require 'test_helper'
class RegistrarAreaLoginTest < ActionDispatch::IntegrationTest
def setup
@user = users(:api_bestnames)
end
def test_correct_username_and_password
visit new_registrar_user_session_url
fill_in 'depp_user_tag', with: @user.username
fill_in 'depp_user_password', with: 'testtest'
click_button 'Login'
assert_text 'Log out'
assert_current_path registrar_poll_path
end
def test_wrong_password
visit new_registrar_user_session_url
fill_in 'depp_user_tag', with: @user.username
fill_in 'depp_user_password', with: 'wrong'
click_button 'Login'
assert_text 'No such user'
assert_current_path new_registrar_user_session_path
end
def test_inactive_user
@user.update!(active: false)
visit new_registrar_user_session_url
fill_in 'depp_user_tag', with: @user.username
fill_in 'depp_user_password', with: 'testtest'
click_button 'Login'
assert_text 'User is not active'
assert_current_path new_registrar_user_session_path
end
end

View file

@ -1,15 +0,0 @@
require 'test_helper'
class RegistrarAreaLogoutTest < ActionDispatch::IntegrationTest
def setup
sign_in users(:api_bestnames)
end
def test_logout
visit registrar_root_url
click_on 'Log out'
assert_text 'Signed out successfully'
assert_current_path new_registrar_user_session_path
end
end

View file

@ -1,22 +0,0 @@
require 'test_helper'
class RegistrarAreaProtectedAreaTest < ActionDispatch::IntegrationTest
def test_anonymous_user_is_asked_to_authenticate_when_navigating_to_protected_area
visit registrar_domains_url
assert_text 'You need to sign in before continuing'
assert_current_path new_registrar_user_session_path
end
def test_authenticated_user_can_access_protected_area
sign_in users(:api_bestnames)
visit registrar_domains_url
assert_current_path registrar_domains_path
end
def test_authenticated_user_is_not_asked_to_authenticate_again
sign_in users(:api_bestnames)
visit new_registrar_user_session_url
assert_text 'You are already signed in'
assert_current_path registrar_poll_path
end
end