mirror of
https://github.com/internetee/registry.git
synced 2025-06-04 11:47:30 +02:00
Merge pull request #1860 from internetee/1857-covered-registry-by-tests
1857 covered registry by tests
This commit is contained in:
commit
bf1f11d72f
21 changed files with 531 additions and 1 deletions
11
test/helpers/form_helper_test.rb
Normal file
11
test/helpers/form_helper_test.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
require 'test_helper'
|
||||
|
||||
class FormHelperTest < ActionView::TestCase
|
||||
def test_legal_document_field
|
||||
meth = MiniTest::Mock.new
|
||||
returned_legal_document_field = ApplicationController.helpers.legal_document_field('Hello', meth)
|
||||
|
||||
assert returned_legal_document_field.include? 'data-legal-document="true"'
|
||||
assert returned_legal_document_field.include? 'accept=".pdf,.asice,.asics,.sce,.scs,.adoc,.edoc,.bdoc,.zip,.rar,.gz,.tar,.7z,.odt,.doc,.docx"'
|
||||
end
|
||||
end
|
9
test/helpers/form_tag_helper_test.rb
Normal file
9
test/helpers/form_tag_helper_test.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
require 'test_helper'
|
||||
|
||||
class FormTagHelperTest < ActionView::TestCase
|
||||
def test_legal_document_field
|
||||
returned_legal_document_field = ApplicationController.helpers.legal_document_field_tag('Hello')
|
||||
assert returned_legal_document_field.include? 'data-legal-document="true"'
|
||||
assert returned_legal_document_field.include? 'accept=".pdf,.asice,.asics,.sce,.scs,.adoc,.edoc,.bdoc,.zip,.rar,.gz,.tar,.7z,.odt,.doc,.docx"'
|
||||
end
|
||||
end
|
|
@ -325,6 +325,104 @@ class EppContactUpdateBaseTest < EppTestCase
|
|||
assert_nil @contact.state
|
||||
end
|
||||
|
||||
def test_update_contact_with_update_prohibited
|
||||
@contact.update(statuses: [Contact::CLIENT_UPDATE_PROHIBITED])
|
||||
@contact.update_columns(code: @contact.code.upcase)
|
||||
|
||||
street = '123 Example'
|
||||
city = 'Tallinn'
|
||||
state = 'Harjumaa'
|
||||
zip = '123456'
|
||||
country_code = 'EE'
|
||||
|
||||
request_xml = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
<command>
|
||||
<update>
|
||||
<contact:update xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
|
||||
<contact:id>#{@contact.code}</contact:id>
|
||||
<contact:chg>
|
||||
<contact:postalInfo>
|
||||
<contact:addr>
|
||||
<contact:street>#{street}</contact:street>
|
||||
<contact:city>#{city}</contact:city>
|
||||
<contact:sp>#{state}</contact:sp>
|
||||
<contact:pc>#{zip}</contact:pc>
|
||||
<contact:cc>#{country_code}</contact:cc>
|
||||
</contact:addr>
|
||||
</contact:postalInfo>
|
||||
</contact:chg>
|
||||
</contact:update>
|
||||
</update>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
@contact.reload
|
||||
|
||||
assert_not_equal city, @contact.city
|
||||
assert_not_equal street, @contact.street
|
||||
assert_not_equal zip, @contact.zip
|
||||
assert_not_equal country_code, @contact.country_code
|
||||
assert_not_equal state, @contact.state
|
||||
|
||||
assert_epp_response :object_status_prohibits_operation
|
||||
end
|
||||
|
||||
def test_legal_document
|
||||
assert_equal 'john-001', @contact.code
|
||||
assert_not_equal 'new name', @contact.name
|
||||
assert_not_equal 'new-email@inbox.test', @contact.email
|
||||
assert_not_equal '+123.4', @contact.phone
|
||||
|
||||
Setting.request_confirmation_on_domain_deletion_enabled = false
|
||||
|
||||
# https://github.com/internetee/registry/issues/415
|
||||
@contact.update_columns(code: @contact.code.upcase)
|
||||
|
||||
assert_not @contact.legal_documents.present?
|
||||
|
||||
request_xml = <<-XML
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||
<command>
|
||||
<update>
|
||||
<contact:update xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd">
|
||||
<contact:id>john-001</contact:id>
|
||||
<contact:chg>
|
||||
<contact:postalInfo>
|
||||
<contact:name>new name</contact:name>
|
||||
</contact:postalInfo>
|
||||
<contact:voice>+123.4</contact:voice>
|
||||
<contact:email>new-email@inbox.test</contact:email>
|
||||
</contact:chg>
|
||||
</contact:update>
|
||||
</update>
|
||||
<extension>
|
||||
<eis:extdata xmlns:eis="https://epp.tld.ee/schema/eis-1.0.xsd">
|
||||
<eis:legalDocument type="pdf">#{'test' * 2000}</eis:legalDocument>
|
||||
</eis:extdata>
|
||||
</extension>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
assert_difference -> { @contact.legal_documents.reload.size } do
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
@contact.reload
|
||||
end
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
assert_equal 'new name', @contact.name
|
||||
assert_equal 'new-email@inbox.test', @contact.email
|
||||
assert_equal '+123.4', @contact.phone
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def make_contact_free_of_domains_where_it_acts_as_a_registrant(contact)
|
||||
|
|
14
test/integration/registrant_area/application_helper_test.rb
Normal file
14
test/integration/registrant_area/application_helper_test.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ApplicationHelperTest < ActionView::TestCase
|
||||
def test_env_style_when_pic_present
|
||||
assert_dom_equal %{<body style={"background-image: url(#{image_path("registrar/bg-#{unstable_env}.png")});"}>},
|
||||
%{<body style={"#{env_style}"}>}
|
||||
end
|
||||
|
||||
def test_env_style_return_nil
|
||||
env_style = ''
|
||||
assert_dom_equal %{<body style=''>},
|
||||
%{<body style={"#{env_style}"}>}
|
||||
end
|
||||
end
|
|
@ -1,6 +1,8 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RegistrarAreaDomainsIntegrationTest < ApplicationIntegrationTest
|
||||
include FormTagHelper
|
||||
|
||||
setup do
|
||||
sign_in users(:api_bestnames)
|
||||
end
|
||||
|
|
|
@ -22,4 +22,43 @@ class DomainDeleteTest < ActiveSupport::TestCase
|
|||
Domains::Delete::DoDelete.run(domain: @domain)
|
||||
end
|
||||
end
|
||||
|
||||
def test_preclean_pendings
|
||||
@domain.registrant_verification_token = "123"
|
||||
@domain.registrant_verification_asked_at = "123"
|
||||
@domain.preclean_pendings
|
||||
|
||||
assert_nil @domain.registrant_verification_token
|
||||
assert_nil @domain.registrant_verification_asked_at
|
||||
end
|
||||
|
||||
def test_clean_pendings
|
||||
@domain.is_admin = true
|
||||
@domain.registrant_verification_token = "123"
|
||||
@domain.registrant_verification_asked_at = "123"
|
||||
@domain.pending_json = { delete: DomainStatus::PENDING_DELETE}
|
||||
@domain.update(statuses: [DomainStatus::PENDING_DELETE_CONFIRMATION,
|
||||
DomainStatus::PENDING_UPDATE,
|
||||
DomainStatus::PENDING_DELETE,
|
||||
])
|
||||
@domain.status_notes[DomainStatus::PENDING_UPDATE] = '123'
|
||||
@domain.status_notes[DomainStatus::PENDING_DELETE] = '234'
|
||||
@domain.reload
|
||||
|
||||
|
||||
@domain.clean_pendings!
|
||||
@domain.reload
|
||||
|
||||
assert @domain.is_admin
|
||||
assert_nil @domain.registrant_verification_token
|
||||
assert_nil @domain.registrant_verification_asked_at
|
||||
assert_equal @domain.pending_json, {}
|
||||
|
||||
assert (not @domain.statuses.include? DomainStatus::PENDING_DELETE_CONFIRMATION)
|
||||
assert (not @domain.statuses.include? DomainStatus::PENDING_UPDATE)
|
||||
assert (not @domain.statuses.include? DomainStatus::PENDING_DELETE)
|
||||
|
||||
assert_equal @domain.status_notes[DomainStatus::PENDING_UPDATE], ''
|
||||
assert_equal @domain.status_notes[DomainStatus::PENDING_DELETE], ''
|
||||
end
|
||||
end
|
||||
|
|
20
test/jobs/domain_delete_job_test.rb
Normal file
20
test/jobs/domain_delete_job_test.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
require "test_helper"
|
||||
|
||||
class DomainDeleteJobTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
travel_to Time.zone.parse('2010-07-05')
|
||||
@domain = domains(:shop)
|
||||
@domain.update!(delete_date:'2010-07-05')
|
||||
@domain.reload
|
||||
end
|
||||
|
||||
def test_delete_domain
|
||||
dom = Domain.find_by(id: @domain.id)
|
||||
assert dom
|
||||
|
||||
DomainDeleteJob.run(@domain.id)
|
||||
|
||||
dom = Domain.find_by(id: @domain.id)
|
||||
assert_nil dom
|
||||
end
|
||||
end
|
29
test/jobs/domain_expire_email_job_test.rb
Normal file
29
test/jobs/domain_expire_email_job_test.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
require "test_helper"
|
||||
|
||||
class DomainExpireEmailJobTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
@domain = domains(:shop)
|
||||
travel_to Time.zone.parse('2010-08-06')
|
||||
@domain.update(valid_to: Time.now - 1.day)
|
||||
@domain.reload
|
||||
end
|
||||
|
||||
def test_domain_expire
|
||||
success = DomainExpireEmailJob.run(@domain.id)
|
||||
assert success
|
||||
end
|
||||
|
||||
def test_domain_expire_with_force_delete
|
||||
@domain.update(statuses: [DomainStatus::FORCE_DELETE])
|
||||
@domain.reload
|
||||
assert_equal ['serverForceDelete'], @domain.statuses
|
||||
|
||||
success = DomainExpireEmailJob.run(@domain.id)
|
||||
assert success
|
||||
|
||||
statuses = @domain.statuses
|
||||
statuses.delete(DomainStatus::FORCE_DELETE)
|
||||
@domain.update(statuses: statuses)
|
||||
assert_equal ['ok'], @domain.statuses
|
||||
end
|
||||
end
|
13
test/jobs/regenerate_registrar_whoises_job_test.rb
Normal file
13
test/jobs/regenerate_registrar_whoises_job_test.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
require "test_helper"
|
||||
|
||||
class RegenerateRegistrarWhoisesJobTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
travel_to Time.zone.parse('2010-07-05 10:00')
|
||||
@registrar = registrars(:bestnames)
|
||||
end
|
||||
|
||||
def test_job_return_true
|
||||
# if return false, then job was failes
|
||||
assert RegenerateRegistrarWhoisesJob.run(@registrar.id)
|
||||
end
|
||||
end
|
62
test/lib/validators/date_time_iso8601_validator_test.rb
Normal file
62
test/lib/validators/date_time_iso8601_validator_test.rb
Normal file
|
@ -0,0 +1,62 @@
|
|||
require 'test_helper'
|
||||
|
||||
class DateTimeIso8601Validatable
|
||||
include ActiveModel::Validations
|
||||
validates_with DateTimeIso8601Validator, :attributes=>[:errors]
|
||||
attr_accessor :code, :type
|
||||
validates :code, iso8601: { date_only: true }, if: :birthday?
|
||||
|
||||
def birthday?
|
||||
type == "birthday"
|
||||
end
|
||||
|
||||
def empty?
|
||||
code.empty?
|
||||
end
|
||||
end
|
||||
|
||||
class DateTimeIso8601ValidatorTest < ActiveSupport::TestCase
|
||||
def test_check_invalid_reverse_date
|
||||
obj = DateTimeIso8601Validatable.new
|
||||
obj.type = "birthday"
|
||||
obj.code = "22-12-2020"
|
||||
assert_not obj.valid?
|
||||
end
|
||||
|
||||
def test_check_date_without_separate_symbols
|
||||
obj = DateTimeIso8601Validatable.new
|
||||
obj.type = "birthday"
|
||||
obj.code = "24521012"
|
||||
assert_not obj.valid?
|
||||
end
|
||||
|
||||
def test_check_empty_date
|
||||
obj = DateTimeIso8601Validatable.new
|
||||
obj.type = "birthday"
|
||||
obj.code = ""
|
||||
assert_not obj.valid?
|
||||
end
|
||||
|
||||
def test_check_valid_date
|
||||
obj = DateTimeIso8601Validatable.new
|
||||
obj.code = Date.new(2000,5,25).iso8601
|
||||
obj.type = "birthday"
|
||||
assert obj.valid?
|
||||
end
|
||||
|
||||
def test_return_code_2005_in_epp_validate
|
||||
obj = DateTimeIso8601Validatable.new
|
||||
obj.code = Date.new(2000,5,25).iso8601
|
||||
obj.type = "birthday"
|
||||
epp_resp = DateTimeIso8601Validator.validate_epp(obj, obj.code)
|
||||
assert_equal epp_resp[:msg], "Expiry absolute must be compatible to ISO 8601"
|
||||
end
|
||||
|
||||
def test_epp_request_with_empty_data
|
||||
obj = DateTimeIso8601Validatable.new
|
||||
obj.code = ""
|
||||
obj.type = "birthday"
|
||||
epp_resp = DateTimeIso8601Validator.validate_epp(obj, obj.code)
|
||||
assert_nil epp_resp
|
||||
end
|
||||
end
|
57
test/lib/validators/duration_iso8601_validator_test.rb
Normal file
57
test/lib/validators/duration_iso8601_validator_test.rb
Normal file
|
@ -0,0 +1,57 @@
|
|||
require 'test_helper'
|
||||
|
||||
class DurationIso8601Validatable
|
||||
include ActiveModel::Validations
|
||||
validates_with DurationIso8601Validator, :attributes=>[:errors]
|
||||
attr_accessor :duration
|
||||
validates :duration, inclusion: { in: Proc.new { |price| price.class.durations } }
|
||||
|
||||
def self.durations
|
||||
[
|
||||
'3 mons',
|
||||
'6 mons',
|
||||
'9 mons',
|
||||
'1 year',
|
||||
'2 years',
|
||||
'3 years',
|
||||
'4 years',
|
||||
'5 years',
|
||||
'6 years',
|
||||
'7 years',
|
||||
'8 years',
|
||||
'9 years',
|
||||
'10 years',
|
||||
]
|
||||
end
|
||||
|
||||
def empty?
|
||||
duration.empty?
|
||||
end
|
||||
end
|
||||
|
||||
class DurationIso8601ValidatorTest < ActiveSupport::TestCase
|
||||
def test_valid_duration
|
||||
dura = DurationIso8601Validatable.new
|
||||
dura.duration = '1 year'
|
||||
assert dura.valid?
|
||||
end
|
||||
|
||||
def test_invalid_duration
|
||||
dura = DurationIso8601Validatable.new
|
||||
dura.duration = 'one millinons years'
|
||||
assert_not dura.valid?
|
||||
end
|
||||
|
||||
def test_empty_duration
|
||||
dura = DurationIso8601Validatable.new
|
||||
dura.duration = ''
|
||||
assert_not dura.valid?
|
||||
end
|
||||
|
||||
def test_return_epp_response_code_2005
|
||||
dura = DurationIso8601Validatable.new
|
||||
dura.duration = '1 year'
|
||||
epp_resp = DurationIso8601Validator.validate_epp(dura, dura.duration)
|
||||
assert_equal epp_resp[:msg], "Expiry relative must be compatible to ISO 8601"
|
||||
end
|
||||
end
|
|
@ -123,6 +123,15 @@ class AdminUserTest < ActiveSupport::TestCase
|
|||
assert user.valid?
|
||||
end
|
||||
|
||||
def test_min_password_length
|
||||
assert_equal AdminUser.min_password_length, 8
|
||||
end
|
||||
|
||||
def test_country_instance
|
||||
user = valid_user
|
||||
assert user.country.present?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def valid_user
|
||||
|
|
17
test/models/certificate_test.rb
Normal file
17
test/models/certificate_test.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
require 'test_helper'
|
||||
|
||||
class CertificateTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
@certificate = certificates(:api)
|
||||
@certificate.update!(csr: "-----BEGIN CERTIFICATE REQUEST-----\nMIICszCCAZsCAQAwbjELMAkGA1UEBhMCRUUxFDASBgNVBAMMC2ZyZXNoYm94LmVl\nMRAwDgYDVQQHDAdUYWxsaW5uMREwDwYDVQQKDAhGcmVzaGJveDERMA8GA1UECAwI\nSGFyanVtYWExETAPBgNVBAsMCEZyZXNoYm94MIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEA1VVESynZoZhIbe8s9zHkELZ/ZDCGiM2Q8IIGb1IOieT5U2mx\nIsVXz85USYsSQY9+4YdEXnupq9fShArT8pstS/VN6BnxdfAiYXc3UWWAuaYAdNGJ\nDr5Jf6uMt1wVnCgoDL7eJq9tWMwARC/viT81o92fgqHFHW0wEolfCmnpik9o0ACD\nFiWZ9IBIevmFqXtq25v9CY2cT9+eZW127WtJmOY/PKJhzh0QaEYHqXTHWOLZWpnp\nHH4elyJ2CrFulOZbHPkPNB9Nf4XQjzk1ffoH6e5IVys2VV5xwcTkF0jY5XTROVxX\nlR2FWqic8Q2pIhSks48+J6o1GtXGnTxv94lSDwIDAQABoAAwDQYJKoZIhvcNAQEL\nBQADggEBAEFcYmQvcAC8773eRTWBJJNoA4kRgoXDMYiiEHih5iJPVSxfidRwYDTF\nsP+ttNTUg3JocFHY75kuM9T2USh+gu/trRF0o4WWa+AbK3JbbdjdT1xOMn7XtfUU\nZ/f1XCS9YdHQFCA6nk4Z+TLWwYsgk7n490AQOiB213fa1UIe83qIfw/3GRqRUZ7U\nwIWEGsHED5WT69GyxjyKHcqGoV7uFnqFN0sQVKVTy/NFRVQvtBUspCbsOirdDRie\nAB2KbGHL+t1QrRF10szwCJDyk5aYlVhxvdI8zn010nrxHkiyQpDFFldDMLJl10BW\n2w9PGO061z+tntdRcKQGuEpnIr9U5Vs=\n-----END CERTIFICATE REQUEST-----\n")
|
||||
end
|
||||
|
||||
def test_does_metadata_is_api
|
||||
api = @certificate.assign_metadata
|
||||
assert api, 'api'
|
||||
end
|
||||
|
||||
def test_certificate_sign_returns_false
|
||||
assert_not @certificate.sign!, 'false'
|
||||
end
|
||||
end
|
|
@ -16,6 +16,20 @@ class DisputedDomainTest < ActiveSupport::TestCase
|
|||
@dispute.reload
|
||||
|
||||
assert @dispute.closed
|
||||
assert @dispute.forward_to_auction_if_possible
|
||||
|
||||
n = Whois::Record.find_by(name: @dispute.domain_name)
|
||||
assert @dispute.remove_whois_data(n)
|
||||
end
|
||||
|
||||
def test_invalid_auth
|
||||
travel_to Time.zone.parse('2010-10-05')
|
||||
assert_not Dispute.valid_auth?(nil, nil)
|
||||
end
|
||||
|
||||
def test_valid_auth
|
||||
travel_to Time.zone.parse('2010-10-05')
|
||||
assert Dispute.valid_auth?(@dispute.domain_name, @dispute.password)
|
||||
end
|
||||
|
||||
def test_syncs_password_to_reserved
|
||||
|
|
58
test/models/dnskey_test.rb
Normal file
58
test/models/dnskey_test.rb
Normal file
|
@ -0,0 +1,58 @@
|
|||
require 'test_helper'
|
||||
|
||||
class DnskeyTest < ActiveSupport::TestCase
|
||||
include EppErrors
|
||||
|
||||
setup do
|
||||
@dnskey = 'AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8'
|
||||
@domain = domains(:shop)
|
||||
end
|
||||
|
||||
def test_valid_dns_key
|
||||
dns = Dnskey.new
|
||||
dns.domain_id = @domain.id
|
||||
dns.flags = 257
|
||||
dns.protocol = 3
|
||||
dns.alg = 8
|
||||
dns.public_key = @dnskey
|
||||
|
||||
assert dns.save
|
||||
end
|
||||
|
||||
def test_invalid_algrorithm
|
||||
dns = Dnskey.new
|
||||
dns.alg = 666
|
||||
errors = dns.validate_algorithm
|
||||
assert_equal errors, ['Valid algorithms are: 3, 5, 6, 7, 8, 10, 13, 14']
|
||||
end
|
||||
|
||||
def test_invalid_protocol
|
||||
dns = Dnskey.new
|
||||
dns.protocol = 666
|
||||
errors = dns.validate_protocol
|
||||
assert_equal errors, ['Valid protocols are: 3']
|
||||
end
|
||||
|
||||
def test_invalid_flags
|
||||
dns = Dnskey.new
|
||||
dns.flags = 666
|
||||
errors = dns.validate_flags
|
||||
assert_equal errors, ['Valid flags are: 0, 256, 257']
|
||||
end
|
||||
|
||||
def test_ds_digest_type_one
|
||||
Setting.ds_digest_type = 1
|
||||
|
||||
dns = Dnskey.new
|
||||
dns.domain_id = @domain.id
|
||||
dns.flags = 257
|
||||
dns.protocol = 3
|
||||
dns.alg = 8
|
||||
dns.public_key = @dnskey
|
||||
|
||||
assert dns.save
|
||||
|
||||
assert_equal dns.ds_digest_type, 1
|
||||
assert_equal dns.ds_digest, '640D173A44D9AF2856FBE282EE64CE11A76DBB84'
|
||||
end
|
||||
end
|
17
test/models/domain_contact_test.rb
Normal file
17
test/models/domain_contact_test.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
require 'test_helper'
|
||||
|
||||
class DomainContactTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
@domain_contact = domain_contacts(:shop_jane)
|
||||
end
|
||||
|
||||
def test_if_domain_contact_type_invalid
|
||||
@domain_contact.update(type: "Some")
|
||||
assert @domain_contact.name, ''
|
||||
end
|
||||
|
||||
def test_value_typeahead
|
||||
assert @domain_contact.value_typeahead, 'Jane'
|
||||
end
|
||||
|
||||
end
|
|
@ -5,6 +5,10 @@ class LegalDocumentTest < ActiveSupport::TestCase
|
|||
assert valid_legal_document.valid?, proc { valid_legal_document.errors.full_messages }
|
||||
end
|
||||
|
||||
def test_duplicate_legal_docs
|
||||
assert LegalDocument.remove_duplicates
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def valid_legal_document
|
||||
|
|
20
test/models/mass_action_test.rb
Normal file
20
test/models/mass_action_test.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
require 'test_helper'
|
||||
|
||||
class MassActionTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
@csv_valid = Rails.root.join('test', 'fixtures', 'files', 'mass_actions', 'valid_mass_force_delete_list.csv').to_s
|
||||
@csv_invalid = Rails.root.join('test', 'fixtures', 'files', 'mass_actions', 'invalid_mass_force_delete_list.csv').to_s
|
||||
end
|
||||
|
||||
def test_mass_action_procces_with_valid_data
|
||||
assert MassAction.process("force_delete", @csv_valid)
|
||||
end
|
||||
|
||||
def test_mass_action_proccess_with_invalid_data
|
||||
assert_not MassAction.process("force_delete", @csv_invalid)
|
||||
end
|
||||
|
||||
def test_mass_action_invalid_attributes
|
||||
assert_not MassAction.process("force_restart", @csv_valid)
|
||||
end
|
||||
end
|
|
@ -15,6 +15,11 @@ class Whois::RecordTest < ActiveSupport::TestCase
|
|||
Setting.registry_whois_disclaimer = @original_disclaimer
|
||||
end
|
||||
|
||||
def test_whois_records_without_auction
|
||||
domain = Whois::Record.without_auctions
|
||||
assert_equal domain[0].name, 'shop.test'
|
||||
end
|
||||
|
||||
def test_reads_disclaimer_setting
|
||||
Setting.registry_whois_disclaimer = JSON.generate({en: 'test_disclaimer'})
|
||||
assert_equal Setting.registry_whois_disclaimer, Whois::Record.disclaimer
|
||||
|
|
|
@ -9,7 +9,7 @@ class AdminContactsTest < ApplicationSystemTestCase
|
|||
end
|
||||
|
||||
def test_update_contact
|
||||
visit admin_contact_path(id: @contact.id)
|
||||
visit admin_contact_path(@contact.id)
|
||||
assert_text "#{@contact.name}"
|
||||
|
||||
click_on 'Edit statuses'
|
||||
|
|
|
@ -5,6 +5,7 @@ class DomainVersionsTest < ApplicationSystemTestCase
|
|||
super
|
||||
|
||||
@registrar = registrars(:bestnames)
|
||||
@domain = domains(:shop)
|
||||
|
||||
create_domain_with_history
|
||||
sign_in users(:admin)
|
||||
|
@ -59,4 +60,35 @@ class DomainVersionsTest < ApplicationSystemTestCase
|
|||
assert_text 'Best Names'
|
||||
assert_text '23.04.18, 18:50 update 1-AdminUser'
|
||||
end
|
||||
|
||||
def test_search_registrant_param
|
||||
visit admin_domain_versions_path
|
||||
fill_in 'Registrant', with: @domain.registrant, match: :first
|
||||
find('.btn.btn-primary').click
|
||||
|
||||
assert_equal current_url,
|
||||
'http://www.example.com/admin/domain_versions?q[name]=&q[registrant]=John&q[registrar]=&q[event]=&results_per_page='
|
||||
end
|
||||
|
||||
def test_search_registrar_param
|
||||
visit admin_domain_versions_path
|
||||
find('#q_registrar').set(@domain.registrar)
|
||||
find('.btn.btn-primary').click
|
||||
|
||||
assert_equal current_url,
|
||||
'http://www.example.com/admin/domain_versions?q[name]=&q[registrant]=&q[registrar]=Best+Names&q[event]=&results_per_page='
|
||||
end
|
||||
|
||||
def test_search_name_param
|
||||
visit admin_domain_versions_path
|
||||
fill_in 'Name', with: @domain.name, match: :first
|
||||
find('.btn.btn-primary').click
|
||||
|
||||
assert_equal current_url,
|
||||
'http://www.example.com/admin/domain_versions?q[name]=shop.test&q[registrant]=&q[registrar]=&q[event]=&results_per_page='
|
||||
end
|
||||
|
||||
def test_search_event_param
|
||||
# TODO
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue