mirror of
https://github.com/internetee/registry.git
synced 2025-07-29 22:16:19 +02:00
Merge branch 'master' into 2275-fix-csv-view-for-historical-data
This commit is contained in:
commit
a7b9fb7bb6
13 changed files with 131 additions and 42 deletions
18
test/interactions/force_delete_email/base_test.rb
Normal file
18
test/interactions/force_delete_email/base_test.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
require 'test_helper'
|
||||
|
||||
class BaseTest < ActiveSupport::TestCase
|
||||
def test_hold_domains_force_delete_email
|
||||
domain = domains(:shop)
|
||||
domain.update!(statuses: [DomainStatus::SERVER_HOLD])
|
||||
domain.update!(expire_time: Time.zone.now + 1.year)
|
||||
|
||||
registrant = domain.registrant
|
||||
registrant.update!(email: "#{registrant.email.split('@').first}@#{domain.name}")
|
||||
|
||||
Domains::ForceDeleteEmail::Base.run(email: registrant.email)
|
||||
|
||||
domain.reload
|
||||
|
||||
assert_not domain.force_delete_scheduled?
|
||||
end
|
||||
end
|
|
@ -41,10 +41,8 @@ class RegistrantUserTest < ActiveSupport::TestCase
|
|||
|
||||
company = Company.new(org.ident, "ace")
|
||||
|
||||
company_register = Minitest::Mock.new
|
||||
company_register.expect(:representation_rights, [company], [{ citizen_personal_code: '1234',
|
||||
citizen_country_code: 'USA' }])
|
||||
@user.companies(company_register)
|
||||
Spy.on(@user, :companies).and_return([company])
|
||||
@user.update_company_contacts
|
||||
org.reload
|
||||
|
||||
assert_equal org.name, company.company_name
|
||||
|
@ -63,6 +61,39 @@ class RegistrantUserTest < ActiveSupport::TestCase
|
|||
company_register.verify
|
||||
end
|
||||
|
||||
def test_should_return_zero_count_of_companies
|
||||
assert_equal 'US-1234', @user.registrant_ident
|
||||
org = contacts(:acme_ltd)
|
||||
org.ident_country_code = 'EE'
|
||||
org.save(validate: false)
|
||||
org.reload
|
||||
|
||||
company_one = Company.new(org.ident, 'Acme Ltd')
|
||||
|
||||
Spy.on(@user, :companies).and_return([company_one])
|
||||
response = @user.do_need_update_contact?
|
||||
org.reload
|
||||
|
||||
assert_equal response[:counter], 0
|
||||
end
|
||||
|
||||
def test_should_return_count_of_contact_which_should_be_updated
|
||||
assert_equal 'US-1234', @user.registrant_ident
|
||||
org = contacts(:acme_ltd)
|
||||
org.ident_country_code = 'EE'
|
||||
org.save(validate: false)
|
||||
org.reload
|
||||
|
||||
company_one = Company.new(org.ident, 'ace')
|
||||
company_two = Company.new(org.ident, 'acer')
|
||||
|
||||
Spy.on(@user, :companies).and_return([company_one, company_two])
|
||||
response = @user.do_need_update_contact?
|
||||
org.reload
|
||||
|
||||
assert_equal response[:counter], 2
|
||||
end
|
||||
|
||||
def test_returns_contacts
|
||||
Contact.stub(:registrant_user_contacts, %w(john jane)) do
|
||||
assert_equal %w(john jane), @user.contacts
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue