mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 13:44:47 +02:00
Merge pull request #1143 from internetee/create-whois-records-on-domain-release
Create whois records on domain release
This commit is contained in:
commit
19fbfbd2df
5 changed files with 26 additions and 9 deletions
|
@ -52,7 +52,7 @@ module Api
|
|||
end
|
||||
|
||||
def update_whois_from_auction(auction)
|
||||
whois_record = Whois::Record.find_or_create_by(name: auction.domain) do |record|
|
||||
whois_record = Whois::Record.find_or_create_by!(name: auction.domain) do |record|
|
||||
record.json = {}
|
||||
end
|
||||
|
||||
|
|
|
@ -92,7 +92,10 @@ module DNS
|
|||
end
|
||||
|
||||
def update_whois_from_auction(auction)
|
||||
whois_record = Whois::Record.find_by!(name: name)
|
||||
whois_record = Whois::Record.find_or_create_by!(name: name) do |record|
|
||||
record.json = {}
|
||||
end
|
||||
|
||||
whois_record.update_from_auction(auction)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,4 +20,4 @@ module Whois
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ class EppDomainCreateAuctionIdnTest < ApplicationIntegrationTest
|
|||
Domain.release_to_auction = false
|
||||
end
|
||||
|
||||
def test_registers_domain_with_ascii_idn_cannot_be_registered_without_registration_code
|
||||
def test_domain_with_ascii_idn_cannot_be_registered_without_registration_code
|
||||
@idn_auction.update!(status: Auction.statuses[:payment_received],
|
||||
registration_code: "auction001")
|
||||
|
||||
|
@ -53,7 +53,7 @@ class EppDomainCreateAuctionIdnTest < ApplicationIntegrationTest
|
|||
response_xml.at_css('result msg').text
|
||||
end
|
||||
|
||||
def test_registers_domain_with_unicode_idn_cannot_be_registered_without_registration_code
|
||||
def test_domain_with_unicode_idn_cannot_be_registered_without_registration_code
|
||||
@idn_auction.update!(status: Auction.statuses[:payment_received],
|
||||
registration_code: "auction001")
|
||||
|
||||
|
@ -91,7 +91,7 @@ class EppDomainCreateAuctionIdnTest < ApplicationIntegrationTest
|
|||
response_xml.at_css('result msg').text
|
||||
end
|
||||
|
||||
def test_registers_domain_with_ascii_idn_cannot_be_registered_without_winning_the_auction
|
||||
def test_domain_with_ascii_idn_cannot_be_registered_without_winning_the_auction
|
||||
@idn_auction.started!
|
||||
|
||||
request_xml = <<-XML
|
||||
|
@ -128,7 +128,7 @@ class EppDomainCreateAuctionIdnTest < ApplicationIntegrationTest
|
|||
response_xml.at_css('result msg').text
|
||||
end
|
||||
|
||||
def test_registers_domain_with_unicode_idn_cannot_be_registered_without_winning_the_auction
|
||||
def test_domain_with_unicode_idn_cannot_be_registered_without_winning_the_auction
|
||||
@idn_auction.started!
|
||||
|
||||
request_xml = <<-XML
|
||||
|
@ -165,7 +165,7 @@ class EppDomainCreateAuctionIdnTest < ApplicationIntegrationTest
|
|||
response_xml.at_css('result msg').text
|
||||
end
|
||||
|
||||
def test_registers_domain_with_unicode_idn_cannot_be_registered_without_winning_the_auction
|
||||
def test_domain_with_unicode_idn_cannot_be_registered_without_winning_the_auction
|
||||
@idn_auction.started!
|
||||
|
||||
request_xml = <<-XML
|
||||
|
|
|
@ -92,6 +92,20 @@ class DNS::DomainNameTest < ActiveSupport::TestCase
|
|||
assert_equal Time.zone.parse('2010-07-05 10:00'), @whois_record.updated_at
|
||||
end
|
||||
|
||||
def test_selling_at_auction_creates_whois_record
|
||||
travel_to Time.zone.parse('2010-07-05 10:00')
|
||||
domain_name = DNS::DomainName.new('new-auction.test')
|
||||
|
||||
domain_name.sell_at_auction
|
||||
|
||||
whois_record = Whois::Record.find_by(name: 'new-auction.test')
|
||||
assert whois_record
|
||||
|
||||
assert_equal Time.zone.parse('2010-07-05 10:00'), whois_record.updated_at
|
||||
assert_equal Time.zone.parse('2010-07-05 10:00'), whois_record.created_at
|
||||
assert_equal ['AtAuction'], whois_record.json['status']
|
||||
end
|
||||
|
||||
def test_at_auction
|
||||
domain_name = DNS::DomainName.new('auction.test')
|
||||
auctions(:one).update!(domain: 'auction.test', status: Auction.statuses[:started])
|
||||
|
@ -162,4 +176,4 @@ class DNS::DomainNameTest < ActiveSupport::TestCase
|
|||
assert_equal 'reserved.test', reserved_domains(:one).name
|
||||
assert_not DNS::DomainName.new('reserved.test').auctionable?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue