Skip to content

Commit

Permalink
Fix visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Beljajev committed May 24, 2018
1 parent db115be commit 01766d4
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion app/views/whois_records/_legal_person.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ name: <%= json['registrant'] %>
org id: <%= json['registrant_reg_no'] %>
country: <%= json['registrant_ident_country_code'] %>
email: Not Disclosed - Visit www.internet.ee for webbased WHOIS
changed: <%= json['changed'].to_s.tr('T',' ').sub('+', ' +') %>
changed: Not Disclosed - Visit www.internet.ee for webbased WHOIS

<%- if json['admin_contacts'].present? -%>
Administrative contact:
Expand Down
2 changes: 1 addition & 1 deletion app/views/whois_records/_legal_person.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ json.nameservers_changed whois_record.json['nameservers_changed']
json.outzone whois_record.json['outzone']
json.registered whois_record.json['registered']

json.registrant_changed whois_record.json['registrant_changed']
json.registrant_changed 'Not Disclosed - Visit www.internet.ee for webbased WHOIS'
json.registrant_kind whois_record.json['registrant_kind']

json.registrar whois_record.json['registrar']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ name: <%= json['registrant'] %>
org id: <%= json['registrant_reg_no'] %>
country: <%= json['registrant_ident_country_code'] %>
email: <%= json['email'] %>
changed: <%= json['changed'].to_s.tr('T',' ').sub('+', ' +') %>
changed: <%= json['registrant_changed'].to_s.tr('T',' ').sub('+', ' +') %>

<%- if json['admin_contacts'].present? -%>
Administrative contact:
Expand Down
2 changes: 1 addition & 1 deletion app/views/whois_records/_private_person.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ json.nameservers_changed whois_record.json['nameservers_changed']
json.outzone whois_record.json['outzone']
json.registered whois_record.json['registered']

json.registrant_changed whois_record.json['registrant_changed']
json.registrant_changed (ip_in_whitelist ? whois_record.json['registrant_changed'] : 'Not Disclosed')
json.registrant_kind whois_record.json['registrant_kind']

json.registrar whois_record.json['registrar']
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/whois_records.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ privately_owned:
registrant_kind: priv
registrar: test
registrar_address: "test, test, test, test"
registrar_changed: "2018-04-25T14:10:39+03:00"
registrar_changed: "2018-04-25T14:10:30+03:00"
registrar_phone: ~
registrar_website: ~
status:
Expand Down
8 changes: 4 additions & 4 deletions test/integration/whois_records/html_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_show_sensitive_data_of_legal_entity_when_captcha_is_solved
org id: 123
country: EE
email: owner@company-domain.test
changed: 2018-04-25 14:10:41 +03:00
changed: 2018-04-25 14:10:39 +03:00
Administrative contact:
name: Admin Contact
Expand Down Expand Up @@ -145,7 +145,7 @@ def test_hide_sensitive_data_of_legal_entity_when_captcha_is_unsolved
org id: 123
country: EE
email: Not Disclosed - Visit www.internet.ee for webbased WHOIS
changed: 2018-04-25 14:10:41 +03:00
changed: Not Disclosed - Visit www.internet.ee for webbased WHOIS
Administrative contact:
name: Not Disclosed - Visit www.internet.ee for webbased WHOIS
Expand Down Expand Up @@ -199,7 +199,7 @@ def test_show_sensitive_data_of_legal_entity_when_ip_is_in_whitelist
org id: 123
country: EE
email: owner@company-domain.test
changed: 2018-04-25 14:10:41 +03:00
changed: 2018-04-25 14:10:39 +03:00
Administrative contact:
name: Admin Contact
Expand Down Expand Up @@ -253,7 +253,7 @@ def test_hide_sensitive_data_of_legal_entity_when_ip_is_not_in_whitelist
org id: 123
country: EE
email: Not Disclosed - Visit www.internet.ee for webbased WHOIS
changed: 2018-04-25 14:10:41 +03:00
changed: Not Disclosed - Visit www.internet.ee for webbased WHOIS
Administrative contact:
name: Not Disclosed - Visit www.internet.ee for webbased WHOIS
Expand Down
28 changes: 13 additions & 15 deletions test/integration/whois_records/json_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ def test_discarded_returns_minimal_json
refute(response_json.has_key?('registrant'))
end

def test_json_does_not_include_private_person_contact_data
get('/v1/privatedomain.test.json')

response_json = JSON.parse(response.body)
assert_equal('127.0.0.1', request.remote_ip)
assert_equal('Not Disclosed', response_json['email'])
assert_equal('Private Person', response_json['registrant'])
end

def test_json_all_fields_are_present
expected_response = {
'admin_contacts': [{'changed': 'Not Disclosed',
Expand All @@ -70,11 +61,11 @@ def test_json_all_fields_are_present
'outzone': nil,
'registered': '2018-04-25T14:10:41+03:00',
'registrant': 'Private Person',
'registrant_changed': '2018-04-25T14:10:39+03:00',
'registrant_changed': 'Not Disclosed',
'registrant_kind': 'priv',
'registrar': 'test',
'registrar_address': 'test, test, test, test',
'registrar_changed': '2018-04-25T14:10:39+03:00',
'registrar_changed': '2018-04-25T14:10:30+03:00',
'registrar_phone': nil,
'registrar_website': nil,
'status': ['inactive'],
Expand All @@ -94,8 +85,9 @@ def test_hide_sensitive_data_of_private_entity_when_captcha_is_unsolved

response_json = JSON.parse(response.body, symbolize_names: true)

assert_equal 'Not Disclosed', response_json[:email]
assert_equal 'Private Person', response_json[:registrant]
assert_equal 'Not Disclosed', response_json[:email]
assert_equal 'Not Disclosed', response_json[:registrant_changed]

expected_admin_contacts = [
{ name: 'Not Disclosed',
Expand All @@ -117,6 +109,8 @@ def test_hide_sensitive_data_of_legal_entity_when_captcha_is_unsolved
response_json = JSON.parse(response.body, symbolize_names: true)

assert_equal 'Not Disclosed - Visit www.internet.ee for webbased WHOIS', response_json[:email]
assert_equal 'Not Disclosed - Visit www.internet.ee for webbased WHOIS',
response_json[:registrant_changed]

expected_admin_contacts = [
{ name: 'Not Disclosed - Visit www.internet.ee for webbased WHOIS',
Expand All @@ -139,8 +133,9 @@ def test_show_sensitive_data_of_private_entity_when_ip_is_in_whitelist
get '/v1/privatedomain.test', format: :json
response_json = JSON.parse(response.body, symbolize_names: true)

assert_equal 'owner@privatedomain.test', response_json[:email]
assert_equal 'test', response_json[:registrant]
assert_equal 'owner@privatedomain.test', response_json[:email]
assert_equal '2018-04-25T14:10:39+03:00', response_json[:registrant_changed]

expected_admin_contacts = [
{ name: 'Admin Contact',
Expand All @@ -162,8 +157,9 @@ def test_show_sensitive_data_of_legal_entity_when_ip_is_in_whitelist
get '/v1/company-domain.test', format: :json
response_json = JSON.parse(response.body, symbolize_names: true)

assert_equal 'owner@company-domain.test', response_json[:email]
assert_equal 'test', response_json[:registrant]
assert_equal 'owner@company-domain.test', response_json[:email]
assert_equal '2018-04-25T14:10:39+03:00', response_json[:registrant_changed]

expected_admin_contacts = [
{ name: 'Admin Contact',
Expand All @@ -186,8 +182,8 @@ def test_hide_sensitive_data_of_private_entity_when_ip_is_not_in_whitelist

response_json = JSON.parse(response.body, symbolize_names: true)

assert_equal 'Not Disclosed', response_json[:email]
assert_equal 'Private Person', response_json[:registrant]
assert_equal 'Not Disclosed', response_json[:email]

expected_admin_contacts = [
{ name: 'Not Disclosed',
Expand All @@ -211,6 +207,8 @@ def test_hide_sensitive_data_of_legal_entity_when_ip_is_not_in_whitelist
response_json = JSON.parse(response.body, symbolize_names: true)

assert_equal 'Not Disclosed - Visit www.internet.ee for webbased WHOIS', response_json[:email]
assert_equal 'Not Disclosed - Visit www.internet.ee for webbased WHOIS',
response_json[:registrant_changed]

expected_admin_contacts = [
{ name: 'Not Disclosed - Visit www.internet.ee for webbased WHOIS',
Expand Down

0 comments on commit 01766d4

Please sign in to comment.