Make sure that only admin contacts and registrants can lock a domain

This commit is contained in:
Maciej Szlosarczyk 2018-08-24 12:54:05 +03:00
parent 1d53e7bb5b
commit a64b03d204
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
4 changed files with 49 additions and 14 deletions

View file

@ -4,20 +4,27 @@ class RegistrantUserTest < ActiveSupport::TestCase
def setup
super
@user = RegistrantUser.new(registrant_ident: 'US-1234')
@user = users(:registrant)
end
def teardown
super
end
def test_domains_returns_an_list_of_domains_associated_with_a_specific_id_code
def test_domains_returns_an_list_of_distinct_domains_associated_with_a_specific_id_code
domain_names = @user.domains.pluck(:name)
assert_equal(3, domain_names.length)
# User is a registrant, but not a contact for the domain.
refute(domain_names.include?('shop.test'))
end
def test_administrated_domains_returns_a_list_of_domains_that_is_smaller_than_domains
assert_equal(2, @user.administrated_domains.count)
def test_administrated_domains_returns_a_list_of_domains
domain_names = @user.administrated_domains.pluck(:name)
assert_equal(3, domain_names.length)
# User is a tech contact for the domain.
refute(domain_names.include?('library.test'))
end
def test_contacts_returns_an_list_of_contacts_associated_with_a_specific_id_code