added test

This commit is contained in:
Oleg Hasjanov 2021-05-26 12:04:55 +03:00
parent ea13926ee6
commit ec97e45921
3 changed files with 34 additions and 2 deletions

View file

@ -31,7 +31,7 @@
<import namespace="https://epp.tld.ee/schema/contact-ee-1.1" <import namespace="https://epp.tld.ee/schema/contact-ee-1.1"
schemaLocation="lib/schemas/contact-ee-1.1.xsd"/> schemaLocation="lib/schemas/contact-ee-1.1.xsd"/>
<import namespace="https://epp.tld.ee/schema/domain-eis-1.1" <import namespace="https://epp.tld.ee/schema/domain-eis-1.1"
schemaLocation="lib/schemas/domain-eis-1.0.xsd"/> schemaLocation="lib/schemas/domain-eis-1.1.xsd"/>
<annotation> <annotation>
<documentation> <documentation>

View file

@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="https://epp.tld.ee/schema/domain-eis-1.1.xsd" <schema targetNamespace="https://epp.tld.ee/schema/domain-eis-1.1.xsd"
xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.1.xsd" xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.1.xsd"

View file

@ -25,6 +25,7 @@ class EppDomainInfoBaseTest < EppTestCase
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body) response_xml = Nokogiri::XML(response.body)
p response_xml
assert_epp_response :completed_successfully assert_epp_response :completed_successfully
assert_equal 'shop.test', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text assert_equal 'shop.test', response_xml.at_xpath('//domain:name', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}").text
assert_equal 'ok', response_xml.at_xpath('//domain:status', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['s'] assert_equal 'ok', response_xml.at_xpath('//domain:status', 'domain' => "#{Xsd::Schema.filename(for_prefix: 'domain-eis')}")['s']
@ -71,6 +72,37 @@ class EppDomainInfoBaseTest < EppTestCase
assert_equal 0, schema_validation_errors.size assert_equal 0, schema_validation_errors.size
end end
def test_returns_valid_response_if_release_prohibited
domain = domains(:shop)
domain.update_columns(statuses: [DomainStatus::SERVER_RELEASE_PROHIBITED],
created_at: Time.now - 5.days,
creator_str: 'test',
delete_date: Time.now - 1.day)
request_xml = <<-XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<epp xmlns="#{Xsd::Schema.filename(for_prefix: 'epp-ee')}">
<command>
<info>
<domain:info xmlns:domain="#{Xsd::Schema.filename(for_prefix: 'domain-eis')}">
<domain:name>shop.test</domain:name>
</domain:info>
</info>
</command>
</epp>
XML
post epp_info_path, params: { frame: request_xml },
headers: { 'HTTP_COOKIE' => 'session=api_bestnames' }
response_xml = Nokogiri::XML(response.body)
assert_epp_response :completed_successfully
schema = EPP_ALL_SCHEMA
schema_validation_errors = schema.validate(response_xml)
assert_equal 0, schema_validation_errors.size
end
def test_reveals_transfer_code_when_domain_is_owned_by_current_user def test_reveals_transfer_code_when_domain_is_owned_by_current_user
assert_equal '65078d5', domains(:shop).transfer_code assert_equal '65078d5', domains(:shop).transfer_code