mirror of
https://github.com/internetee/registry.git
synced 2025-07-30 22:46:22 +02:00
Fix tests
This commit is contained in:
parent
59fe7dffbe
commit
057f026cc0
2 changed files with 19 additions and 4 deletions
|
@ -72,7 +72,8 @@ module Api
|
||||||
contact.disclosed_attributes = disclosed_attributes
|
contact.disclosed_attributes = disclosed_attributes
|
||||||
end
|
end
|
||||||
|
|
||||||
contact.registrant_publishable = reparsed_request_json[:registrant_publishable]
|
publishable = reparsed_request_json[:registrant_publishable]
|
||||||
|
contact.registrant_publishable = publishable if publishable.in? [true, false]
|
||||||
|
|
||||||
logger.debug "Setting.address_processing is set to #{Setting.address_processing}"
|
logger.debug "Setting.address_processing is set to #{Setting.address_processing}"
|
||||||
|
|
||||||
|
|
|
@ -229,12 +229,12 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
||||||
assert_equal %w[phone], @contact.disclosed_attributes
|
assert_equal %w[phone], @contact.disclosed_attributes
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_registrant_publishable_change_when_present
|
def test_registrant_publishable_change_when_true
|
||||||
@contact = contacts(:acme_ltd)
|
@contact = contacts(:acme_ltd)
|
||||||
@contact.update!(registrant_publishable: false)
|
@contact.update!(registrant_publishable: false)
|
||||||
|
|
||||||
patch api_v1_registrant_contact_path(@contact.uuid),
|
patch api_v1_registrant_contact_path(@contact.uuid),
|
||||||
params: { disclosed_attributes: %w[], publishable: true },
|
params: { disclosed_attributes: %w[], registrant_publishable: true },
|
||||||
as: :json,
|
as: :json,
|
||||||
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||||
@contact.reload
|
@contact.reload
|
||||||
|
@ -243,6 +243,19 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
||||||
assert @contact.registrant_publishable
|
assert @contact.registrant_publishable
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_registrant_publishable_change_when_false
|
||||||
|
@contact = contacts(:acme_ltd)
|
||||||
|
@contact.update!(registrant_publishable: true)
|
||||||
|
|
||||||
|
patch api_v1_registrant_contact_path(@contact.uuid),
|
||||||
|
params: { disclosed_attributes: %w[], registrant_publishable: false },
|
||||||
|
as: :json,
|
||||||
|
headers: { 'HTTP_AUTHORIZATION' => auth_token }
|
||||||
|
@contact.reload
|
||||||
|
|
||||||
|
assert_response :ok
|
||||||
|
assert_not @contact.registrant_publishable
|
||||||
|
end
|
||||||
|
|
||||||
def test_return_contact_details
|
def test_return_contact_details
|
||||||
patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'new name' },
|
patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'new name' },
|
||||||
|
@ -268,7 +281,8 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
||||||
},
|
},
|
||||||
auth_info: @contact.auth_info,
|
auth_info: @contact.auth_info,
|
||||||
statuses: @contact.statuses,
|
statuses: @contact.statuses,
|
||||||
disclosed_attributes: @contact.disclosed_attributes }),
|
disclosed_attributes: @contact.disclosed_attributes,
|
||||||
|
registrant_publishable: @contact.registrant_publishable }),
|
||||||
JSON.parse(response.body, symbolize_names: true)
|
JSON.parse(response.body, symbolize_names: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue