mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 07:52:04 +02:00
Contact Epp tests refactored to use EppXml gem
This commit is contained in:
parent
afcec06fe3
commit
b046927c95
6 changed files with 171 additions and 195 deletions
78
spec/support/epp_contact_xml_helper.rb
Normal file
78
spec/support/epp_contact_xml_helper.rb
Normal file
|
@ -0,0 +1,78 @@
|
|||
module EppContactXmlHelper
|
||||
def create_contact_xml(xml_params={})
|
||||
defaults = {
|
||||
postalInfo: {
|
||||
name: { value: 'John Doe' },
|
||||
addr: {
|
||||
street: { value: '123 Example' },
|
||||
city: { value: 'Tallinn' },
|
||||
cc: { value: 'EE' }
|
||||
}
|
||||
},
|
||||
voice: { value: '+372.1234567' },
|
||||
email: { value: 'test@example.example' },
|
||||
ident: { value: '37605030299' }
|
||||
}
|
||||
|
||||
xml_params = defaults.deep_merge(xml_params)
|
||||
EppXml::Contact.create(xml_params)
|
||||
end
|
||||
|
||||
def update_contact_xml(xml_params={})
|
||||
defaults = {
|
||||
id: { value: 'asd123123er' },
|
||||
authInfo: { pw: { value: 'password' } },
|
||||
chg: {
|
||||
postalInfo: {
|
||||
name: { value: 'John Doe Edited' }
|
||||
},
|
||||
voice: { value: '+372.7654321' },
|
||||
email: { value: 'edited@example.example' }
|
||||
}
|
||||
}
|
||||
xml_params = defaults.deep_merge(xml_params)
|
||||
EppXml::Contact.update(xml_params)
|
||||
end
|
||||
|
||||
def delete_contact_xml(xml_params={})
|
||||
defaults = { id: { value: 'sh8012' } }
|
||||
xml_params = defaults.deep_merge(xml_params)
|
||||
EppXml::Contact.delete(xml_params)
|
||||
end
|
||||
|
||||
def info_contact_xml(xml_params={})
|
||||
defaults = { id: { value: 'sh8012' }, authInfo: { pw: { value: 'password' } } }
|
||||
xml_params = defaults.deep_merge(xml_params)
|
||||
EppXml::Contact.info(xml_params)
|
||||
end
|
||||
|
||||
def check_contact_xml(xml_params={})
|
||||
defaults = {
|
||||
id: { value: 'ad123c3' }
|
||||
}
|
||||
xml_params = defaults.deep_merge(xml_params)
|
||||
EppXml::Contact.check(xml_params)
|
||||
end
|
||||
|
||||
def check_multiple_contacts_xml
|
||||
'<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<check>
|
||||
<contact:check
|
||||
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
|
||||
<contact:id>check-1234</contact:id>
|
||||
<contact:id>check-4321</contact:id>
|
||||
</contact:check>
|
||||
</check>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.include EppContactXmlHelper
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue