mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 21:54:48 +02:00
Simplify test
This commit is contained in:
parent
b4be9e7f00
commit
19e45f0a70
2 changed files with 28 additions and 25 deletions
|
@ -1,25 +0,0 @@
|
|||
require 'application_system_test_case'
|
||||
|
||||
class AdminAreaNewApiUserTest < ApplicationSystemTestCase
|
||||
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
|
28
test/system/admin_area/registrars/api_users_test.rb
Normal file
28
test/system/admin_area/registrars/api_users_test.rb
Normal file
|
@ -0,0 +1,28 @@
|
|||
require 'application_system_test_case'
|
||||
|
||||
class AdminRegistrarsApiUsersSystemTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
sign_in users(:admin)
|
||||
end
|
||||
|
||||
def test_creates_new_api_user_with_required_attributes
|
||||
username = 'john'
|
||||
registrar = registrars(:bestnames)
|
||||
|
||||
visit admin_registrar_path(registrar)
|
||||
click_on 'New API user'
|
||||
|
||||
fill_in 'Username', with: username
|
||||
fill_in 'Password', with: valid_password
|
||||
click_on 'Save'
|
||||
|
||||
assert_text 'Record created'
|
||||
assert_text "Username #{username}"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def valid_password
|
||||
'testtest'
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue