mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 02:05:57 +02:00
Merge pull request #1929 from internetee/1927-disputes-closing-fix
Validating info epp response on disputed domain against schema
This commit is contained in:
commit
aa97b4954b
10 changed files with 120 additions and 41 deletions
|
@ -22,7 +22,6 @@ class AdminDisputesSystemTest < ApplicationSystemTestCase
|
|||
|
||||
fill_in 'Domain name', with: 'hospital.test'
|
||||
fill_in 'Password', with: '1234'
|
||||
fill_in 'Starts at', with: (Time.zone.today - 2.years).to_s
|
||||
fill_in 'Comment', with: 'Sample comment'
|
||||
click_on 'Save'
|
||||
|
||||
|
@ -38,7 +37,6 @@ class AdminDisputesSystemTest < ApplicationSystemTestCase
|
|||
|
||||
fill_in 'Domain name', with: 'nonexistant.test'
|
||||
fill_in 'Password', with: '1234'
|
||||
fill_in 'Starts at', with: Time.zone.today.to_s
|
||||
fill_in 'Comment', with: 'Sample comment'
|
||||
click_on 'Save'
|
||||
|
||||
|
@ -46,30 +44,14 @@ class AdminDisputesSystemTest < ApplicationSystemTestCase
|
|||
assert_text 'nonexistant.test'
|
||||
end
|
||||
|
||||
def test_throws_error_if_starts_at_is_in_future
|
||||
assert_nil Dispute.active.find_by(domain_name: 'disputed.test')
|
||||
|
||||
visit admin_disputes_path
|
||||
click_on 'New disputed domain'
|
||||
|
||||
fill_in 'Domain name', with: 'disputed.test'
|
||||
fill_in 'Password', with: '1234'
|
||||
fill_in 'Starts at', with: (Time.zone.today + 2.day).to_s
|
||||
fill_in 'Comment', with: 'Sample comment'
|
||||
click_on 'Save'
|
||||
|
||||
assert_text "Can not be greater than today's date"
|
||||
end
|
||||
|
||||
def test_updates_dispute
|
||||
assert_not_equal Time.zone.today, @dispute.starts_at
|
||||
|
||||
visit edit_admin_dispute_path(@dispute)
|
||||
fill_in 'Starts at', with: Time.zone.today.to_s
|
||||
fill_in 'Comment', with: 'Sample comment with new text'
|
||||
click_link_or_button 'Save'
|
||||
|
||||
assert_text 'Dispute was successfully updated'
|
||||
assert_text Time.zone.today
|
||||
end
|
||||
|
||||
def test_deletes_dispute
|
||||
|
@ -79,11 +61,11 @@ class AdminDisputesSystemTest < ApplicationSystemTestCase
|
|||
end
|
||||
|
||||
def test_can_not_create_overlapping_dispute
|
||||
travel_to @dispute.starts_at + 1.day
|
||||
visit admin_disputes_path
|
||||
click_on 'New disputed domain'
|
||||
|
||||
fill_in 'Domain name', with: 'active-dispute.test'
|
||||
fill_in 'Starts at', with: @dispute.starts_at + 1.day
|
||||
click_on 'Save'
|
||||
|
||||
assert_text 'Dispute already exists for this domain at given timeframe'
|
||||
|
|
|
@ -34,6 +34,43 @@ class EppDomainInfoBaseTest < EppTestCase
|
|||
assert_equal '2010-07-07T00:00:00+03:00', response_xml.at_xpath('//domain:exDate', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text
|
||||
end
|
||||
|
||||
def test_returns_valid_response_if_disputed
|
||||
dispute = disputes(:expired)
|
||||
dispute.update!(starts_at: Time.zone.now, expires_at: Time.zone.now + 5.days, closed: nil)
|
||||
|
||||
domain = domains(:shop)
|
||||
domain.update_columns(statuses: [DomainStatus::DISPUTED],
|
||||
created_at: Time.zone.parse('2010-07-05'),
|
||||
updated_at: Time.zone.parse('2010-07-06'),
|
||||
creator_str: 'test',
|
||||
valid_to: Time.zone.parse('2010-07-07'))
|
||||
|
||||
domain.versions.destroy_all
|
||||
|
||||
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>
|
||||
<info>
|
||||
<domain:info xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||
<domain:name>shop.test</domain:name>
|
||||
</domain:info>
|
||||
</info>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
post epp_info_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
|
||||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_epp_response :completed_successfully
|
||||
schema = EPP_ALL_SCHEMA
|
||||
|
||||
schema_validation_errors = schema.validate(response_xml)
|
||||
assert_equal 0, schema_validation_errors.size
|
||||
end
|
||||
|
||||
def test_reveals_transfer_code_when_domain_is_owned_by_current_user
|
||||
assert_equal '65078d5', domains(:shop).transfer_code
|
||||
|
||||
|
@ -109,4 +146,4 @@ class EppDomainInfoBaseTest < EppTestCase
|
|||
assert_nil response_xml.at_xpath('//domain:authInfo/domain:pw',
|
||||
'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -301,7 +301,7 @@ class EppDomainUpdateBaseTest < EppTestCase
|
|||
current = @domain.registrant
|
||||
new_registrant = contacts(:william)
|
||||
new_registrant.update(
|
||||
ident: current.ident,
|
||||
ident: current.ident,
|
||||
ident_type: current.ident_type,
|
||||
ident_country_code: current.ident_country_code
|
||||
)
|
||||
|
@ -331,7 +331,7 @@ class EppDomainUpdateBaseTest < EppTestCase
|
|||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
@domain.reload
|
||||
|
||||
# NOTE: completed_successfully_action_pending
|
||||
# NOTE: completed_successfully_action_pending
|
||||
assert_epp_response :completed_successfully
|
||||
refute_includes @domain.statuses, DomainStatus::PENDING_UPDATE
|
||||
|
||||
|
@ -414,6 +414,48 @@ class EppDomainUpdateBaseTest < EppTestCase
|
|||
assert_no_emails
|
||||
end
|
||||
|
||||
def test_dispute_password_mandatory_when_registrant_changed
|
||||
Setting.request_confirmation_on_registrant_change_enabled = true
|
||||
dispute = disputes(:expired)
|
||||
dispute.update!(starts_at: Time.zone.now, expires_at: Time.zone.now + 5.days, closed: nil)
|
||||
new_registrant = contacts(:william)
|
||||
|
||||
assert @domain.disputed?
|
||||
|
||||
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>
|
||||
<domain:update xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||
<domain:name>#{@domain.name}</domain:name>
|
||||
<domain:chg>
|
||||
<domain:registrant verified="yes">#{new_registrant.code}</domain:registrant>
|
||||
</domain:chg>
|
||||
</domain: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:reserved>
|
||||
<eis:pw>'123456'</eis:pw>
|
||||
</eis:reserved>
|
||||
</eis:extdata>
|
||||
</extension>
|
||||
</command>
|
||||
</epp>
|
||||
XML
|
||||
|
||||
post epp_update_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
|
||||
@domain.reload
|
||||
|
||||
assert_epp_response :invalid_authorization_information
|
||||
assert_not_equal new_registrant, @domain.registrant
|
||||
assert @domain.disputed?
|
||||
assert_no_emails
|
||||
end
|
||||
|
||||
def test_skips_verification_when_disabled
|
||||
Setting.request_confirmation_on_registrant_change_enabled = false
|
||||
new_registrant = contacts(:william).becomes(Registrant)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue