From 34f1e2be2f4b41d4d08105a687695ab835071a4a Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Mon, 19 Feb 2018 02:40:25 +0200 Subject: [PATCH] Improve tests #694 --- test/integration/api/domain_transfers_test.rb | 7 +++++++ test/integration/epp/domain/transfer/request_test.rb | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/test/integration/api/domain_transfers_test.rb b/test/integration/api/domain_transfers_test.rb index 938fec53f..12c8c78c1 100644 --- a/test/integration/api/domain_transfers_test.rb +++ b/test/integration/api/domain_transfers_test.rb @@ -3,6 +3,7 @@ require 'test_helper' class APIDomainTransfersTest < ActionDispatch::IntegrationTest def setup @domain = domains(:shop) + Setting.transfer_wait_time = 0 # Auto-approval end def test_returns_domain_transfers @@ -14,6 +15,12 @@ class APIDomainTransfersTest < ActionDispatch::IntegrationTest JSON.parse(response.body, symbolize_names: true) end + def test_creates_new_domain_transfer + assert_difference -> { @domain.domain_transfers.size } do + post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } + end + end + def test_approves_automatically_if_auto_approval_is_enabled post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } assert @domain.domain_transfers(true).last.approved? diff --git a/test/integration/epp/domain/transfer/request_test.rb b/test/integration/epp/domain/transfer/request_test.rb index 5031760c3..8ad1f6c92 100644 --- a/test/integration/epp/domain/transfer/request_test.rb +++ b/test/integration/epp/domain/transfer/request_test.rb @@ -12,6 +12,12 @@ class EppDomainTransferRequestTest < ActionDispatch::IntegrationTest assert_equal 1, Nokogiri::XML(response.body).css('result').size end + def test_creates_new_domain_transfer + assert_difference -> { @domain.domain_transfers.size } do + post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' } + end + end + def test_approves_automatically_if_auto_approval_is_enabled post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' } assert_equal 'serverApproved', Nokogiri::XML(response.body).xpath('//domain:trStatus', 'domain' =>