mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 11:16:00 +02:00
parent
5d61cbf4a8
commit
daba47790c
9 changed files with 125 additions and 125 deletions
|
@ -4,64 +4,60 @@ class Whois::RecordTest < ActiveSupport::TestCase
|
|||
fixtures 'whois/records'
|
||||
|
||||
setup do
|
||||
@whois_record = whois_records(:one)
|
||||
@auction = auctions(:one)
|
||||
|
||||
@original_disclaimer_setting = Setting.registry_whois_disclaimer
|
||||
Setting.registry_whois_disclaimer = 'disclaimer'
|
||||
end
|
||||
|
||||
teardown do
|
||||
Setting.registry_whois_disclaimer = @original_disclaimer_setting
|
||||
end
|
||||
|
||||
def test_reads_disclaimer_from_settings
|
||||
def test_reads_disclaimer_setting
|
||||
Setting.registry_whois_disclaimer = 'test disclaimer'
|
||||
assert_equal 'test disclaimer', Whois::Record.disclaimer
|
||||
end
|
||||
|
||||
def test_creates_new_whois_record_when_domain_is_at_auction
|
||||
domain_name = DNS::DomainName.new('some.test')
|
||||
Setting.registry_whois_disclaimer = 'disclaimer'
|
||||
def test_updates_whois_record_from_auction_when_started
|
||||
@auction.update!(domain: 'domain.test', status: Auction.statuses[:started])
|
||||
@whois_record.update!(name: 'domain.test')
|
||||
@whois_record.update_from_auction(@auction)
|
||||
@whois_record.reload
|
||||
|
||||
domain_name.stub(:at_auction?, true) do
|
||||
assert_difference 'Whois::Record.count' do
|
||||
Whois::Record.refresh(domain_name)
|
||||
end
|
||||
end
|
||||
|
||||
whois_record = Whois::Record.last
|
||||
assert_equal 'some.test', whois_record.name
|
||||
assert_equal ({ 'name' => 'some.test',
|
||||
assert_equal ({ 'name' => 'domain.test',
|
||||
'status' => ['AtAuction'],
|
||||
'disclaimer' => 'disclaimer' }), whois_record.json
|
||||
'disclaimer' => 'disclaimer' }), @whois_record.json
|
||||
end
|
||||
|
||||
def test_refreshes_whois_record_when_domain_auction_reaches_awaiting_payment_state
|
||||
domain_name = DNS::DomainName.new('some.test')
|
||||
Setting.registry_whois_disclaimer = 'disclaimer'
|
||||
whois_records(:one).update!(name: 'some.test')
|
||||
def test_updates_whois_record_from_auction_when_no_bids
|
||||
@auction.update!(domain: 'domain.test', status: Auction.statuses[:no_bids])
|
||||
@whois_record.update!(name: 'domain.test')
|
||||
@whois_record.update_from_auction(@auction)
|
||||
|
||||
domain_name.stub(:awaiting_payment?, true) do
|
||||
Whois::Record.refresh(domain_name)
|
||||
end
|
||||
assert_not Whois::Record.exists?(name: 'domain.test')
|
||||
end
|
||||
|
||||
whois_record = Whois::Record.find_by(name: 'some.test')
|
||||
assert_equal 'some.test', whois_record.name
|
||||
assert_equal ({ 'name' => 'some.test',
|
||||
def test_updates_whois_record_from_auction_when_awaiting_payment
|
||||
@auction.update!(domain: 'domain.test', status: Auction.statuses[:awaiting_payment])
|
||||
@whois_record.update!(name: 'domain.test')
|
||||
@whois_record.update_from_auction(@auction)
|
||||
@whois_record.reload
|
||||
|
||||
assert_equal ({ 'name' => 'domain.test',
|
||||
'status' => ['PendingRegistration'],
|
||||
'disclaimer' => 'disclaimer' }), whois_record.json
|
||||
'disclaimer' => 'disclaimer' }), @whois_record.json
|
||||
end
|
||||
|
||||
def test_refreshes_whois_record_when_domain_auction_reaches_pending_registration_state
|
||||
domain_name = DNS::DomainName.new('some.test')
|
||||
Setting.registry_whois_disclaimer = 'disclaimer'
|
||||
whois_records(:one).update!(name: 'some.test')
|
||||
def test_updates_whois_record_from_auction_when_payment_received
|
||||
@auction.update!(domain: 'domain.test', status: Auction.statuses[:payment_received])
|
||||
@whois_record.update!(name: 'domain.test')
|
||||
@whois_record.update_from_auction(@auction)
|
||||
@whois_record.reload
|
||||
|
||||
domain_name.stub(:pending_registration?, true) do
|
||||
Whois::Record.refresh(domain_name)
|
||||
end
|
||||
|
||||
whois_record = Whois::Record.find_by(name: 'some.test')
|
||||
assert_equal 'some.test', whois_record.name
|
||||
assert_equal ({ 'name' => 'some.test',
|
||||
assert_equal ({ 'name' => 'domain.test',
|
||||
'status' => ['PendingRegistration'],
|
||||
'disclaimer' => 'disclaimer' }), whois_record.json
|
||||
'disclaimer' => 'disclaimer' }), @whois_record.json
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue