mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 05:34:46 +02:00
On status update, create WHOIS records for domains in auction
Should fix sporadic errors we are seeing with the integration
This commit is contained in:
parent
f35b2dc36c
commit
d590b5d937
2 changed files with 18 additions and 2 deletions
|
@ -52,7 +52,10 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_whois_from_auction(auction)
|
def update_whois_from_auction(auction)
|
||||||
whois_record = Whois::Record.find_by!(name: auction.domain)
|
whois_record = Whois::Record.find_or_create_by(name: auction.domain) do |record|
|
||||||
|
record.body = {}
|
||||||
|
end
|
||||||
|
|
||||||
whois_record.update_from_auction(auction)
|
whois_record.update_from_auction(auction)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -98,6 +98,19 @@ class ApiV1AuctionUpdateTest < ActionDispatch::IntegrationTest
|
||||||
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.updated_at
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_creates_whois_record_if_does_not_exist
|
||||||
|
travel_to Time.zone.parse('2010-07-05 10:00')
|
||||||
|
assert_equal 'auction.test', @auction.domain
|
||||||
|
@whois_record.delete
|
||||||
|
|
||||||
|
patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:payment_received] }
|
||||||
|
.to_json, 'Content-Type' => Mime::JSON.to_s
|
||||||
|
|
||||||
|
new_whois_record = Whois::Record.find_by(name: @auction.domain)
|
||||||
|
assert_equal Time.zone.parse('2010-07-05 10:00'), new_whois_record.updated_at
|
||||||
|
assert_equal ['PendingRegistration'], new_whois_record.json['status']
|
||||||
|
end
|
||||||
|
|
||||||
def test_inaccessible_when_ip_address_is_not_allowed
|
def test_inaccessible_when_ip_address_is_not_allowed
|
||||||
ENV['auction_api_allowed_ips'] = ''
|
ENV['auction_api_allowed_ips'] = ''
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue