mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 21:54:48 +02:00
Eliminate mystery guest
This commit is contained in:
parent
8425481091
commit
ca1c9614e5
1 changed files with 7 additions and 4 deletions
|
@ -9,6 +9,8 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
||||||
@original_business_registry_cache_setting = Setting.days_to_keep_business_registry_cache
|
@original_business_registry_cache_setting = Setting.days_to_keep_business_registry_cache
|
||||||
@original_fax_enabled_setting = ENV['fax_enabled']
|
@original_fax_enabled_setting = ENV['fax_enabled']
|
||||||
|
|
||||||
|
@current_user = users(:registrant)
|
||||||
|
|
||||||
Setting.days_to_keep_business_registry_cache = 1
|
Setting.days_to_keep_business_registry_cache = 1
|
||||||
travel_to Time.zone.parse('2010-07-05')
|
travel_to Time.zone.parse('2010-07-05')
|
||||||
end
|
end
|
||||||
|
@ -214,16 +216,17 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
||||||
symbolize_names: true)
|
symbolize_names: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_contact_of_another_user_cannot_be_updated
|
def test_unmanaged_contact_cannot_be_updated
|
||||||
@contact = contacts(:jack)
|
@current_user.update!(registrant_ident: 'US-1234')
|
||||||
|
@contact.update!(ident: '12345')
|
||||||
|
|
||||||
patch api_v1_registrant_contact_path(@contact.uuid), { name: 'any' }.to_json,
|
patch api_v1_registrant_contact_path(@contact.uuid), { name: 'any' }.to_json,
|
||||||
'HTTP_AUTHORIZATION' => auth_token,
|
'HTTP_AUTHORIZATION' => auth_token,
|
||||||
'Accept' => Mime::JSON,
|
'Accept' => Mime::JSON,
|
||||||
'Content-Type' => Mime::JSON.to_s
|
'Content-Type' => Mime::JSON.to_s
|
||||||
|
@contact.reload
|
||||||
|
|
||||||
assert_response :not_found
|
assert_response :not_found
|
||||||
@contact.reload
|
|
||||||
assert_not_equal 'any', @contact.name
|
assert_not_equal 'any', @contact.name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -244,7 +247,7 @@ class RegistrantApiV1ContactUpdateTest < ActionDispatch::IntegrationTest
|
||||||
private
|
private
|
||||||
|
|
||||||
def auth_token
|
def auth_token
|
||||||
token_creator = AuthTokenCreator.create_with_defaults(users(:registrant))
|
token_creator = AuthTokenCreator.create_with_defaults(@current_user)
|
||||||
hash = token_creator.token_in_hash
|
hash = token_creator.token_in_hash
|
||||||
"Bearer #{hash[:access_token]}"
|
"Bearer #{hash[:access_token]}"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue