NS bulk change: Add tests, don't use name_puny format

This commit is contained in:
Karl Erik Õunapuu 2020-11-18 16:29:18 +02:00
parent 331ade988c
commit 1db594fc1c
No known key found for this signature in database
GPG key ID: C9DD647298A34764
4 changed files with 52 additions and 1 deletions

View file

@ -20,4 +20,20 @@ class ReplaceNameserversTest < ActiveSupport::TestCase
assert_equal([], result)
end
def test_replace_nameserver_in_bulk_respects_domain_limit_scope
eligible_domain = domains(:shop)
unscoped_domain = domains(:airport)
new_attributes = { hostname: 'ns-updated1.bestnames.test', ipv4: '192.0.3.1',
ipv6: '2001:db8::2' }
result = @registrar.replace_nameservers('ns1.bestnames.test', new_attributes, domains: ['shop.test'])
assert_equal(["shop.test"], result)
unscoped_domain.reload
eligible_domain.reload
assert eligible_domain.nameservers.where(hostname: 'ns1.bestnames.test').empty?
assert unscoped_domain.nameservers.where(hostname: 'ns1.bestnames.test').any?
end
end