diff --git a/spec/epp/epp_helper_spec.rb b/spec/epp/epp_helper_spec.rb
index b0318eadb..05eb71d46 100644
--- a/spec/epp/epp_helper_spec.rb
+++ b/spec/epp/epp_helper_spec.rb
@@ -228,6 +228,115 @@ describe 'EPP Helper', epp: true do
end
it 'generates valid update xml' do
+ # Detailed update
+ expected = Nokogiri::XML('
+
+
+
+
+ example.ee
+
+
+ ns2.example.com
+
+ mak21
+
+ Payment overdue.
+
+
+
+ ns1.example.com
+
+ sh8013
+
+
+
+ mak21
+
+ 2BARfoo
+
+
+
+
+ ABC-12345
+
+
+ ').to_s.squish
+
+ generated = Nokogiri::XML(domain_update_xml).to_s.squish
+ expect(generated).to eq(expected)
+
+ # Edited detailed update
+
+ expected = Nokogiri::XML('
+
+
+
+
+ one.ee
+
+ sh8013
+ Payment overdue.
+
+
+
+
+ ns1.example.net
+ 192.0.2.2
+ 1080:0:0:0:8:800:200C:417A
+
+
+ sh8013
+
+
+
+ sh8013
+
+ b3rafsla
+
+
+
+
+ ABC-12345
+
+
+ ').to_s.squish
+
+ xml = domain_update_xml(
+ name: { value: 'one.ee' },
+ add: [
+ ns: nil,
+ contact: { value: 'sh8013', attrs: { type: 'admin' } },
+ status: { value: 'Payment overdue.', attrs: { s: 'testStatus', lang: 'et' } }
+ ],
+ rem: [
+ ns: [
+ hostAttr: [
+ { hostName: { value: 'ns1.example.net' } },
+ { hostAddr: { value: '192.0.2.2', attrs: { ip: 'v4' } } },
+ { hostAddr: { value: '1080:0:0:0:8:800:200C:417A', attrs: { ip: 'v6' } } }
+ ]
+ ],
+ contact: { attrs: { type: 'tech' }, value: 'sh8013' },
+ status: { attrs: { s: 'clientUpdateProhibited' }, value: '' }
+ ],
+ chg: [
+ registrant: { value: 'sh8013' },
+ authInfo: [
+ pw: { value: 'b3rafsla' }
+ ]
+ ]
+ )
+
+ generated = Nokogiri::XML(xml).to_s.squish
+ expect(generated).to eq(expected)
+
+ ## Update without add and rem
+
expected = Nokogiri::XML('
@@ -248,7 +357,7 @@ describe 'EPP Helper', epp: true do
').to_s.squish
- xml = domain_update_xml(add: nil)
+ xml = domain_update_xml(add: nil, rem: nil)
generated = Nokogiri::XML(xml).to_s.squish
expect(generated).to eq(expected)
@@ -275,6 +384,7 @@ describe 'EPP Helper', epp: true do
xml = domain_update_xml(
name: { value: 'one.ee' },
add: nil,
+ rem: nil,
chg: [
registrant: { value: 'sh8013' },
authInfo: [
diff --git a/spec/support/epp.rb b/spec/support/epp.rb
index 7b17d36d9..232eab153 100644
--- a/spec/support/epp.rb
+++ b/spec/support/epp.rb
@@ -163,20 +163,29 @@ module Epp
def domain_update_xml(xml_params = {})
defaults = {
name: { value: 'example.ee' },
+ add: [
+ { ns:
+ [
+ hostObj: { value: 'ns1.example.com' },
+ hostObj: { value: 'ns2.example.com' }
+ ]
+ },
+ { contact: { attrs: { type: 'tech' }, value: 'mak21' } },
+ { status: { attrs: { s: 'clientUpdateProhibited' }, value: '' } },
+ { status: { attrs: { s: 'clientHold', lang: 'en' }, value: 'Payment overdue.' } }
+ ],
+ rem: [
+ ns: [
+ hostObj: { value: 'ns1.example.com' }
+ ],
+ contact: { attrs: { type: 'tech' }, value: 'sh8013' },
+ status: { attrs: { s: 'clientUpdateProhibited' }, value: '' }
+ ],
chg: [
registrant: { value: 'mak21' },
authInfo: [
pw: { value: '2BARfoo' }
]
- ],
- add: [
- ns: [
- hostObj: { value: 'ns1.example.com' },
- hostObj: { value: 'ns2.example.com' }
- ],
- status: { attrs: { s: 'clientHold', lang: 'en' }, value: 'Payment overdue.' },
- status: { attrs: { s: 'clientUpdateProhibited' }, value: '' },
- contact: { attrs: { type: 'tech' }, value: 'mak21' }
]
}