mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 13:36:15 +02:00
Merge pull request #2741 from internetee/disclose-phone-num-for-org-registrants
Update company_register gem and fix logger dependency
This commit is contained in:
commit
268b942042
9 changed files with 282 additions and 19 deletions
|
@ -253,4 +253,32 @@ class ReppV1ContactsCreateTest < ActionDispatch::IntegrationTest
|
|||
|
||||
CompanyRegister::Client.define_singleton_method(:new, original_new_method)
|
||||
end
|
||||
|
||||
def test_validates_phone_number_after_create
|
||||
request_body = {
|
||||
contact: {
|
||||
name: 'Test Company',
|
||||
phone: '+372.51111112',
|
||||
email: 'test@company.com',
|
||||
ident: {
|
||||
ident_type: 'org',
|
||||
ident_country_code: 'EE',
|
||||
ident: '12345678',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
assert_enqueued_with(job: OrgRegistrantPhoneCheckerJob) do
|
||||
post '/repp/v1/contacts', headers: @auth_headers, params: request_body
|
||||
end
|
||||
|
||||
assert_response :ok
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal 1000, json[:code]
|
||||
assert_equal 'Command completed successfully', json[:message]
|
||||
|
||||
contact = Contact.find_by(code: json[:data][:contact][:code])
|
||||
assert contact.present?
|
||||
assert_equal '+372.51111112', contact.phone
|
||||
end
|
||||
end
|
||||
|
|
|
@ -142,4 +142,31 @@ class ReppV1ContactsUpdateTest < ActionDispatch::IntegrationTest
|
|||
ENV["shunter_default_threshold"] = '10000'
|
||||
ENV["shunter_enabled"] = 'false'
|
||||
end
|
||||
|
||||
def test_validates_phone_number_after_update
|
||||
@contact.update!(
|
||||
phone: '+372.555666777',
|
||||
ident_type: 'org',
|
||||
ident_country_code: 'EE',
|
||||
ident: '12345678'
|
||||
)
|
||||
|
||||
request_body = {
|
||||
contact: {
|
||||
phone: '+372.123456789'
|
||||
}
|
||||
}
|
||||
|
||||
assert_enqueued_with(job: OrgRegistrantPhoneCheckerJob) do
|
||||
put "/repp/v1/contacts/#{@contact.code}", headers: @auth_headers, params: request_body
|
||||
end
|
||||
|
||||
assert_response :ok
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
assert_equal 1000, json[:code]
|
||||
assert_equal 'Command completed successfully', json[:message]
|
||||
|
||||
@contact.reload
|
||||
assert_equal '+372.123456789', @contact.phone
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue