mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
Add some tests #2741
This commit is contained in:
parent
b6d1fa666b
commit
527f65ebfb
2 changed files with 24 additions and 0 deletions
|
@ -325,15 +325,21 @@ describe 'EPP Domain', epp: true do
|
|||
end
|
||||
|
||||
it 'creates a domain with period in days' do
|
||||
old_balance = @registrar1.balance
|
||||
old_activities = @registrar1.cash_account.account_activities.count
|
||||
xml = domain_create_xml(period_value: 365, period_unit: 'd')
|
||||
|
||||
response = epp_plain_request(xml)
|
||||
response[:msg].should == 'Command completed successfully'
|
||||
response[:result_code].should == '1000'
|
||||
Domain.first.valid_to.should be_within(60).of(1.year.since)
|
||||
@registrar1.balance.should be < old_balance
|
||||
@registrar1.cash_account.account_activities.count.should == old_activities + 1
|
||||
end
|
||||
|
||||
it 'does not create a domain with invalid period' do
|
||||
old_balance = @registrar1.balance
|
||||
old_activities = @registrar1.cash_account.account_activities.count
|
||||
xml = domain_create_xml({
|
||||
period: { value: '367', attrs: { unit: 'd' } }
|
||||
})
|
||||
|
@ -342,6 +348,8 @@ describe 'EPP Domain', epp: true do
|
|||
response[:results][0][:result_code].should == '2306'
|
||||
response[:results][0][:msg].should == 'Period must add up to 1, 2 or 3 years [period]'
|
||||
response[:results][0][:value].should == '367'
|
||||
@registrar1.balance.should == old_balance
|
||||
@registrar1.cash_account.account_activities.count.should == old_activities
|
||||
end
|
||||
|
||||
it 'creates a domain with multiple dnskeys' do
|
||||
|
|
|
@ -144,5 +144,21 @@ describe Registrar do
|
|||
it 'should not have priv contacts' do
|
||||
@registrar.priv_contacts.size.should == 0
|
||||
end
|
||||
|
||||
it 'should credit and debit registrar cash account' do
|
||||
@registrar.credit!(13.32, 'Add money')
|
||||
@registrar.balance.should == BigDecimal.new('13.32')
|
||||
@registrar.cash_account.account_activities.count.should == 1
|
||||
a = @registrar.cash_account.account_activities.last
|
||||
a.description.should == 'Add money'
|
||||
a.sum.should == BigDecimal.new('13.32')
|
||||
|
||||
@registrar.debit!(10.31, 'Remove money')
|
||||
@registrar.balance.should == BigDecimal.new('3.01')
|
||||
@registrar.cash_account.account_activities.count.should == 2
|
||||
a = @registrar.cash_account.account_activities.last
|
||||
a.description.should == 'Remove money'
|
||||
a.sum.should == -BigDecimal.new('10.31')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue