mirror of
https://github.com/internetee/registry.git
synced 2025-07-30 22:46:22 +02:00
Added csv export to registrar api_users and white_ips
This commit is contained in:
parent
316f00cadc
commit
0f16ec77f5
11 changed files with 104 additions and 6 deletions
2
test/fixtures/files/api_users.csv
vendored
Normal file
2
test/fixtures/files/api_users.csv
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
Username,Password,Identity Code,Role,Active,Accredited,Accreditation Expire Date,Created,Updated
|
||||
test_bestnames,testtest,1234,super,true,false,,2010-07-05 10:30:00 +0300,2010-07-05 10:30:00 +0300
|
|
2
test/fixtures/files/white_ips.csv
vendored
Normal file
2
test/fixtures/files/white_ips.csv
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
IPv4,IPv6,Interfaces,Created,Updated
|
||||
127.0.0.1,,"REGISTRAR, API",2010-07-05 10:30:00 +0300,2010-07-05 10:30:00 +0300
|
|
|
@ -22,6 +22,26 @@ class AdminRegistrarsApiUsersSystemTest < ApplicationSystemTestCase
|
|||
assert_current_path admin_registrar_api_user_path(registrar, new_api_user)
|
||||
end
|
||||
|
||||
def test_downloads_api_users_list_as_csv
|
||||
travel_to Time.zone.parse('2010-07-05 10:30')
|
||||
registrar = registrars(:bestnames)
|
||||
api_users = registrar.api_users
|
||||
api_users.each do |u|
|
||||
u.created_at = Time.zone.now
|
||||
u.updated_at = Time.zone.now
|
||||
u.save(validate: false)
|
||||
end
|
||||
|
||||
visit admin_registrar_path(registrar)
|
||||
within('.api_users') do
|
||||
click_on 'Export to CSV'
|
||||
end
|
||||
|
||||
assert_equal "attachment; filename=\"#{registrar.name.parameterize}_api_users_#{Time.zone.now.to_formatted_s(:number)}.csv\"; " \
|
||||
"filename*=UTF-8''#{registrar.name.parameterize}_api_users_#{Time.zone.now.to_formatted_s(:number)}.csv", response_headers['Content-Disposition']
|
||||
assert_equal file_fixture('api_users.csv').read, page.body
|
||||
end
|
||||
|
||||
def test_shows_api_user_details
|
||||
api_user = users(:api_bestnames)
|
||||
|
||||
|
|
27
test/system/admin_area/registrars/white_ips_test.rb
Normal file
27
test/system/admin_area/registrars/white_ips_test.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
require 'application_system_test_case'
|
||||
|
||||
class AdminRegistrarsWhiteIpsSystemTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
sign_in users(:admin)
|
||||
end
|
||||
|
||||
def test_downloads_whitelisted_ips_list_as_csv
|
||||
travel_to Time.zone.parse('2010-07-05 10:30')
|
||||
registrar = registrars(:bestnames)
|
||||
white_ips = registrar.white_ips
|
||||
white_ips.each do |ip|
|
||||
ip.created_at = Time.zone.now
|
||||
ip.updated_at = Time.zone.now
|
||||
ip.save(validate: false)
|
||||
end
|
||||
|
||||
visit admin_registrar_path(registrar)
|
||||
within('.white_ips') do
|
||||
click_on 'Export to CSV'
|
||||
end
|
||||
|
||||
assert_equal "attachment; filename=\"#{registrar.name.parameterize}_white_ips_#{Time.zone.now.to_formatted_s(:number)}.csv\"; " \
|
||||
"filename*=UTF-8''#{registrar.name.parameterize}_white_ips_#{Time.zone.now.to_formatted_s(:number)}.csv", response_headers['Content-Disposition']
|
||||
assert_equal file_fixture('white_ips.csv').read, page.body
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue