Introduce 'optional' validator to epp controllers

This commit is contained in:
Martin Lensment 2015-01-23 13:08:35 +02:00
parent 3a529135ea
commit e6b36c409d
6 changed files with 96 additions and 16 deletions

View file

@ -112,6 +112,30 @@ describe 'EPP Keyrelay', epp: true do
expect(zone.messages.queued.count).to eq(0)
end
it 'returns an error on invalid absolute expiry' do
xml = epp_xml.keyrelay({
name: { value: 'example.ee' },
keyData: {
flags: { value: '256' },
protocol: { value: '3' },
alg: { value: '8' },
pubKey: { value: 'cmlraXN0aGViZXN0' }
},
authInfo: {
pw: { value: domain.auth_info }
},
expiry: {
absolute: { value: 'Invalid Absolute' }
}
})
response = epp_request(xml, :xml, :elkdata)
expect(response[:msg]).to eq('Expiry absolute must be compatible to ISO 8601')
expect(response[:results][0][:value]).to eq('Invalid Absolute')
expect(zone.messages.queued.count).to eq(0)
end
it 'does not allow both relative and absolute' do
xml = epp_xml.keyrelay({
name: { value: 'example.ee' },