mirror of
https://github.com/internetee/registry.git
synced 2025-07-30 14:36:22 +02:00
Merge branch 'master' into 499-admin-wildcard-search
This commit is contained in:
parent
f93286c2e6
commit
fd6e625d25
49 changed files with 382 additions and 160 deletions
|
@ -29,4 +29,16 @@ class AdminAccountsSystemTest < ApplicationSystemTestCase
|
|||
assert_text 'Account has been successfully updated'
|
||||
assert_text '234'
|
||||
end
|
||||
|
||||
def test_download_accounts_list_as_csv
|
||||
travel_to Time.zone.parse('2010-07-05 10:30')
|
||||
|
||||
get admin_accounts_path(format: :csv)
|
||||
|
||||
assert_response :ok
|
||||
assert_equal 'text/csv; charset=utf-8', response.headers['Content-Type']
|
||||
assert_equal %(attachment; filename="accounts_#{Time.zone.now.to_formatted_s(:number)}.csv"; filename*=UTF-8''accounts_#{Time.zone.now.to_formatted_s(:number)}.csv),
|
||||
response.headers['Content-Disposition']
|
||||
assert_equal file_fixture('accounts.csv').read, response.body
|
||||
end
|
||||
end
|
||||
|
|
|
@ -62,11 +62,10 @@ class ContactVersionsTest < ApplicationSystemTestCase
|
|||
travel_to now
|
||||
|
||||
get admin_contact_versions_path(format: :csv)
|
||||
|
||||
assert_response :ok
|
||||
assert_equal 'text/csv; charset=utf-8', response.headers['Content-Type']
|
||||
assert_equal %(attachment; filename="contact_history_#{Time.zone.now.to_formatted_s(:number)}.csv"; filename*=UTF-8''contact_history_#{Time.zone.now.to_formatted_s(:number)}.csv),
|
||||
response.headers['Content-Disposition']
|
||||
assert_not_empty response.body
|
||||
assert_equal file_fixture('contact_versions.csv').read, response.body
|
||||
end
|
||||
end
|
||||
|
|
22
test/system/admin_area/contacts/csv_test.rb
Normal file
22
test/system/admin_area/contacts/csv_test.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
require 'application_system_test_case'
|
||||
|
||||
class ContactsCsvTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
sign_in users(:admin)
|
||||
Domain.destroy_all
|
||||
Contact.all.each { |contact| contact.destroy unless contact.name == 'Acme Ltd' }
|
||||
end
|
||||
|
||||
def test_download_contacts_list_as_csv
|
||||
travel_to Time.zone.parse('2010-07-05 10:30')
|
||||
contact = Contact.first
|
||||
contact.created_at = Time.zone.now
|
||||
contact.save(validate: false)
|
||||
|
||||
visit admin_contacts_url
|
||||
click_link('CSV')
|
||||
|
||||
assert_equal "attachment; filename=\"contacts_#{Time.zone.now.to_formatted_s(:number)}.csv\"; filename*=UTF-8''contacts_#{Time.zone.now.to_formatted_s(:number)}.csv", response_headers['Content-Disposition']
|
||||
assert_equal file_fixture('contacts.csv').read, page.body
|
||||
end
|
||||
end
|
|
@ -98,7 +98,7 @@ class DomainVersionsTest < ApplicationSystemTestCase
|
|||
assert_equal 'text/csv; charset=utf-8', response.headers['Content-Type']
|
||||
assert_equal %(attachment; filename="domain_history_#{Time.zone.now.to_formatted_s(:number)}.csv"; filename*=UTF-8''domain_history_#{Time.zone.now.to_formatted_s(:number)}.csv),
|
||||
response.headers['Content-Disposition']
|
||||
assert_not_empty response.body
|
||||
assert_equal file_fixture('domain_versions.csv').read, response.body
|
||||
end
|
||||
|
||||
def test_search_event_param
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
require 'application_system_test_case'
|
||||
|
||||
class AdminAreaCsvTest < ApplicationSystemTestCase
|
||||
class DomainsCsvTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
sign_in users(:admin)
|
||||
Domain.all.each { |domain| domain.destroy unless domain.name == 'metro.test' }
|
||||
end
|
||||
|
||||
def test_downloads_domain_list_as_csv
|
||||
search_params = {"valid_to_lteq"=>nil}
|
||||
expected_csv = Domain.includes(:registrar, :registrant).search(search_params).result.to_csv
|
||||
|
||||
def test_download_domains_list_as_csv
|
||||
travel_to Time.zone.parse('2010-07-05 10:30')
|
||||
domain = Domain.first
|
||||
domain.created_at = Time.zone.now
|
||||
domain.save(validate: false)
|
||||
|
||||
visit admin_domains_url
|
||||
click_link('CSV')
|
||||
|
||||
assert_equal "attachment; filename=\"domains_#{Time.zone.now.to_formatted_s(:number)}.csv\"; filename*=UTF-8''domains_#{Time.zone.now.to_formatted_s(:number)}.csv", response_headers['Content-Disposition']
|
||||
assert_equal expected_csv, page.body
|
||||
assert_equal file_fixture('domains.csv').read, page.body
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,4 +40,14 @@ class AdminAreaInvoicesTest < ApplicationSystemTestCase
|
|||
assert_current_path admin_invoice_path(@invoice)
|
||||
assert_text 'Invoice has been sent'
|
||||
end
|
||||
|
||||
def test_download_invoices_list_as_csv
|
||||
travel_to Time.zone.parse('2010-07-05 10:30')
|
||||
|
||||
visit admin_invoices_url
|
||||
click_link('CSV')
|
||||
|
||||
assert_equal "attachment; filename=\"invoices_#{Time.zone.now.to_formatted_s(:number)}.csv\"; filename*=UTF-8''invoices_#{Time.zone.now.to_formatted_s(:number)}.csv", response_headers['Content-Disposition']
|
||||
assert_equal file_fixture('invoices.csv').read, page.body
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue