mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 05:34:46 +02:00
Add semantic test fixes & maybe solution for an issue
This commit is contained in:
parent
541c2d769a
commit
21fc5edb44
2 changed files with 12 additions and 11 deletions
|
@ -59,7 +59,7 @@ module Concerns::Domain::Transferable
|
|||
copied_ids = []
|
||||
domain_contacts.each do |dc|
|
||||
contact = Contact.find(dc.contact_id)
|
||||
next if copied_ids.include?(contact.id) || contact.registrar == new_registrar
|
||||
next if copied_ids.include?(uniq_contact_hash(dc)) || contact.registrar == new_registrar
|
||||
|
||||
if registrant_id_was == contact.id # registrant was copied previously, do not copy it again
|
||||
oc = OpenStruct.new(id: registrant_id)
|
||||
|
@ -72,7 +72,11 @@ module Concerns::Domain::Transferable
|
|||
else
|
||||
dc.update(contact_id: oc.id)
|
||||
end
|
||||
copied_ids << contact.id
|
||||
copied_ids << uniq_contact_hash(dc)
|
||||
end
|
||||
end
|
||||
|
||||
def uniq_contact_hash(contact)
|
||||
Digest::SHA1.hexdigest(contact.contact_id.to_s + contact.type)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,16 +14,11 @@ class EppDomainTransferRequestTest < EppTestCase
|
|||
|
||||
def test_new_contacts_should_be_created_after_transfer_domain
|
||||
registrar_id = @domain.registrar.id
|
||||
contacts_id_values = []
|
||||
|
||||
contact_id = Contact.find_by(registrar_id: registrar_id)
|
||||
new_contact = Contact.find_by(registrar_id: registrar_id)
|
||||
|
||||
@domain.domain_contacts[0].update!(contact_id: contact_id.id)
|
||||
@domain.domain_contacts[1].update!(contact_id: contact_id.id)
|
||||
|
||||
@domain.domain_contacts.each do |contact|
|
||||
contacts_id_values.push(contact.contact_id)
|
||||
end
|
||||
@domain.domain_contacts[0].update!(contact_id: new_contact.id)
|
||||
@domain.domain_contacts[1].update!(contact_id: new_contact.id)
|
||||
|
||||
post epp_transfer_path, params: { frame: request_xml },
|
||||
headers: { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||
|
@ -31,7 +26,9 @@ class EppDomainTransferRequestTest < EppTestCase
|
|||
@domain.reload
|
||||
|
||||
assert_epp_response :completed_successfully
|
||||
assert_equal @domain.domain_contacts[0].contact_id, @domain.domain_contacts[1].contact_id
|
||||
|
||||
result_hash = @domain.contacts.pluck(:original_id).group_by(&:itself).transform_values(&:count)
|
||||
assert_equal result_hash[new_contact.id], 2
|
||||
end
|
||||
|
||||
def test_transfers_domain_at_once
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue