4 class UsersControllerTest < ActionDispatch::IntegrationTest
6 # test all routes which lead to this controller
9 { :path => "/api/0.6/user/1", :method => :get },
10 { :controller => "api/users", :action => "show", :id => "1" }
13 { :path => "/api/0.6/user/1.json", :method => :get },
14 { :controller => "api/users", :action => "show", :id => "1", :format => "json" }
17 { :path => "/api/0.6/user/details", :method => :get },
18 { :controller => "api/users", :action => "details" }
21 { :path => "/api/0.6/user/details.json", :method => :get },
22 { :controller => "api/users", :action => "details", :format => "json" }
25 { :path => "/api/0.6/user/gpx_files", :method => :get },
26 { :controller => "api/users", :action => "gpx_files" }
29 { :path => "/api/0.6/users", :method => :get },
30 { :controller => "api/users", :action => "index" }
33 { :path => "/api/0.6/users.json", :method => :get },
34 { :controller => "api/users", :action => "index", :format => "json" }
40 :description => "test",
41 :terms_agreed => Date.yesterday,
42 :home_lat => 12.1, :home_lon => 23.4,
45 # check that a visible user is returned properly
46 get api_user_path(:id => user.id)
47 assert_response :success
48 assert_equal "application/xml", response.media_type
50 # check the data that is returned
51 check_xml_details(user, false, false)
53 # check that a suspended user is not returned
54 get api_user_path(:id => create(:user, :suspended).id)
57 # check that a deleted user is not returned
58 get api_user_path(:id => create(:user, :deleted).id)
61 # check that a non-existent user is not returned
62 get api_user_path(:id => 0)
63 assert_response :not_found
65 # check that a visible user is returned properly in json
66 get api_user_path(:id => user.id, :format => "json")
67 assert_response :success
68 assert_equal "application/json", response.media_type
71 js = ActiveSupport::JSON.decode(@response.body)
74 # check the data that is returned
75 check_json_details(js, user, false, false)
80 :home_lat => 12.1, :home_lon => 23.4,
82 good_token = create(:access_token,
84 :allow_read_prefs => true)
85 bad_token = create(:access_token,
87 other_user = create(:user,
88 :home_lat => 12.1, :home_lon => 23.4,
91 # check that we can fetch our own details as XML with read_prefs
92 signed_get api_user_path(:id => user.id), :oauth => { :token => good_token }
93 assert_response :success
94 assert_equal "application/xml", response.media_type
96 # check the data that is returned
97 check_xml_details(user, true, false)
99 # check that we can fetch a different user's details as XML with read_prefs
100 signed_get api_user_path(:id => other_user.id), :oauth => { :token => good_token }
101 assert_response :success
102 assert_equal "application/xml", response.media_type
104 # check the data that is returned
105 check_xml_details(other_user, false, false)
107 # check that we can fetch our own details as XML without read_prefs
108 signed_get api_user_path(:id => user.id), :oauth => { :token => bad_token }
109 assert_response :success
110 assert_equal "application/xml", response.media_type
112 # check the data that is returned
113 check_xml_details(user, false, false)
115 # check that we can fetch our own details as JSON with read_prefs
116 signed_get api_user_path(:id => user.id, :format => "json"), :oauth => { :token => good_token }
117 assert_response :success
118 assert_equal "application/json", response.media_type
121 js = ActiveSupport::JSON.decode(@response.body)
124 # check the data that is returned
125 check_json_details(js, user, true, false)
127 # check that we can fetch a different user's details as JSON with read_prefs
128 signed_get api_user_path(:id => other_user.id, :format => "json"), :oauth => { :token => good_token }
129 assert_response :success
130 assert_equal "application/json", response.media_type
133 js = ActiveSupport::JSON.decode(@response.body)
136 # check the data that is returned
137 check_json_details(js, other_user, false, false)
139 # check that we can fetch our own details as JSON without read_prefs
140 signed_get api_user_path(:id => other_user.id, :format => "json"), :oauth => { :token => bad_token }
141 assert_response :success
142 assert_equal "application/json", response.media_type
145 js = ActiveSupport::JSON.decode(@response.body)
148 # check the data that is returned
149 check_json_details(js, other_user, false, false)
154 :home_lat => 12.1, :home_lon => 23.4,
155 :languages => ["en"])
156 good_token = create(:oauth_access_token,
157 :resource_owner_id => user.id,
158 :scopes => %w[read_prefs])
159 bad_token = create(:oauth_access_token,
160 :resource_owner_id => user.id,
162 other_user = create(:user,
163 :home_lat => 12.1, :home_lon => 23.4,
164 :languages => ["en"])
166 # check that we can fetch our own details as XML with read_prefs
167 get api_user_path(:id => user.id), :headers => bearer_authorization_header(good_token.token)
168 assert_response :success
169 assert_equal "application/xml", response.media_type
171 # check the data that is returned
172 check_xml_details(user, true, false)
174 # check that we can fetch a different user's details as XML with read_prefs
175 get api_user_path(:id => other_user.id), :headers => bearer_authorization_header(good_token.token)
176 assert_response :success
177 assert_equal "application/xml", response.media_type
179 # check the data that is returned
180 check_xml_details(other_user, false, false)
182 # check that we can fetch our own details as XML without read_prefs
183 get api_user_path(:id => user.id), :headers => bearer_authorization_header(bad_token.token)
184 assert_response :success
185 assert_equal "application/xml", response.media_type
187 # check the data that is returned
188 check_xml_details(user, false, false)
190 # check that we can fetch our own details as JSON with read_prefs
191 get api_user_path(:id => user.id, :format => "json"), :headers => bearer_authorization_header(good_token.token)
192 assert_response :success
193 assert_equal "application/json", response.media_type
196 js = ActiveSupport::JSON.decode(@response.body)
199 # check the data that is returned
200 check_json_details(js, user, true, false)
202 # check that we can fetch a different user's details as JSON with read_prefs
203 get api_user_path(:id => other_user.id, :format => "json"), :headers => bearer_authorization_header(good_token.token)
204 assert_response :success
205 assert_equal "application/json", response.media_type
208 js = ActiveSupport::JSON.decode(@response.body)
211 # check the data that is returned
212 check_json_details(js, other_user, false, false)
214 # check that we can fetch our own details as JSON without read_prefs
215 get api_user_path(:id => user.id, :format => "json"), :headers => bearer_authorization_header(bad_token.token)
216 assert_response :success
217 assert_equal "application/json", response.media_type
220 js = ActiveSupport::JSON.decode(@response.body)
223 # check the data that is returned
224 check_json_details(js, user, false, false)
229 :description => "test",
230 :terms_agreed => Date.yesterday,
231 :home_lat => 12.1, :home_lon => 23.4,
232 :languages => ["en"])
233 create(:message, :read, :recipient => user)
234 create(:message, :sender => user)
236 # check that nothing is returned when not logged in
237 get user_details_path
238 assert_response :unauthorized
240 # check that we get a response when logged in
241 auth_header = basic_authorization_header user.email, "test"
242 get user_details_path, :headers => auth_header
243 assert_response :success
244 assert_equal "application/xml", response.media_type
246 # check the data that is returned
247 check_xml_details(user, true, false)
249 # check that data is returned properly in json
250 auth_header = basic_authorization_header user.email, "test"
251 get user_details_path(:format => "json"), :headers => auth_header
252 assert_response :success
253 assert_equal "application/json", response.media_type
256 js = ActiveSupport::JSON.decode(@response.body)
259 # check the data that is returned
260 check_json_details(js, user, true, false)
263 def test_details_oauth1
265 :home_lat => 12.1, :home_lon => 23.4,
266 :languages => ["en"])
267 good_token = create(:access_token,
269 :allow_read_prefs => true)
270 bad_token = create(:access_token,
273 # check that we can't fetch details as XML without read_prefs
274 signed_get user_details_path, :oauth => { :token => bad_token }
275 assert_response :forbidden
277 # check that we can fetch details as XML
278 signed_get user_details_path, :oauth => { :token => good_token }
279 assert_response :success
280 assert_equal "application/xml", response.media_type
282 # check the data that is returned
283 check_xml_details(user, true, false)
285 # check that we can't fetch details as JSON without read_prefs
286 signed_get user_details_path(:format => "json"), :oauth => { :token => bad_token }
287 assert_response :forbidden
289 # check that we can fetch details as JSON
290 signed_get user_details_path(:format => "json"), :oauth => { :token => good_token }
291 assert_response :success
292 assert_equal "application/json", response.media_type
295 js = ActiveSupport::JSON.decode(@response.body)
298 # check the data that is returned
299 check_json_details(js, user, true, false)
302 def test_details_oauth2
304 :home_lat => 12.1, :home_lon => 23.4,
305 :languages => ["en"])
306 good_token = create(:oauth_access_token,
307 :resource_owner_id => user.id,
308 :scopes => %w[read_prefs])
309 bad_token = create(:oauth_access_token,
310 :resource_owner_id => user.id)
311 email_token = create(:oauth_access_token,
312 :resource_owner_id => user.id,
313 :scopes => %w[read_prefs read_email])
315 # check that we can't fetch details as XML without read_prefs
316 get user_details_path, :headers => bearer_authorization_header(bad_token.token)
317 assert_response :forbidden
319 # check that we can fetch details as XML without read_email
320 get user_details_path, :headers => bearer_authorization_header(good_token.token)
321 assert_response :success
322 assert_equal "application/xml", response.media_type
324 # check the data that is returned
325 check_xml_details(user, true, false)
327 # check that we can fetch details as XML with read_email
328 get user_details_path, :headers => bearer_authorization_header(email_token.token)
329 assert_response :success
330 assert_equal "application/xml", response.media_type
332 # check the data that is returned
333 check_xml_details(user, true, true)
335 # check that we can't fetch details as JSON without read_prefs
336 get user_details_path(:format => "json"), :headers => bearer_authorization_header(bad_token.token)
337 assert_response :forbidden
339 # check that we can fetch details as JSON without read_email
340 get user_details_path(:format => "json"), :headers => bearer_authorization_header(good_token.token)
341 assert_response :success
342 assert_equal "application/json", response.media_type
345 js = ActiveSupport::JSON.decode(@response.body)
348 # check the data that is returned
349 check_json_details(js, user, true, false)
351 # check that we can fetch details as JSON with read_email
352 get user_details_path(:format => "json"), :headers => bearer_authorization_header(email_token.token)
353 assert_response :success
354 assert_equal "application/json", response.media_type
357 js = ActiveSupport::JSON.decode(@response.body)
360 # check the data that is returned
361 check_json_details(js, user, true, true)
365 user1 = create(:user, :description => "test1", :terms_agreed => Date.yesterday)
366 user2 = create(:user, :description => "test2", :terms_agreed => Date.yesterday)
367 user3 = create(:user, :description => "test3", :terms_agreed => Date.yesterday)
369 get api_users_path, :params => { :users => user1.id }
370 assert_response :success
371 assert_equal "application/xml", response.media_type
372 assert_select "user", :count => 1 do
373 check_xml_details(user1, false, false)
374 assert_select "user[id='#{user2.id}']", :count => 0
375 assert_select "user[id='#{user3.id}']", :count => 0
378 get api_users_path, :params => { :users => user2.id }
379 assert_response :success
380 assert_equal "application/xml", response.media_type
381 assert_select "user", :count => 1 do
382 assert_select "user[id='#{user1.id}']", :count => 0
383 check_xml_details(user2, false, false)
384 assert_select "user[id='#{user3.id}']", :count => 0
387 get api_users_path, :params => { :users => "#{user1.id},#{user3.id}" }
388 assert_response :success
389 assert_equal "application/xml", response.media_type
390 assert_select "user", :count => 2 do
391 check_xml_details(user1, false, false)
392 assert_select "user[id='#{user2.id}']", :count => 0
393 check_xml_details(user3, false, false)
396 get api_users_path, :params => { :users => user1.id, :format => "json" }
397 assert_response :success
398 assert_equal "application/json", response.media_type
399 js = ActiveSupport::JSON.decode(@response.body)
401 assert_equal 1, js["users"].count
402 check_json_details(js["users"][0], user1, false, false)
404 get api_users_path, :params => { :users => user2.id, :format => "json" }
405 assert_response :success
406 assert_equal "application/json", response.media_type
407 js = ActiveSupport::JSON.decode(@response.body)
409 assert_equal 1, js["users"].count
410 check_json_details(js["users"][0], user2, false, false)
412 get api_users_path, :params => { :users => "#{user1.id},#{user3.id}", :format => "json" }
413 assert_response :success
414 assert_equal "application/json", response.media_type
415 js = ActiveSupport::JSON.decode(@response.body)
417 assert_equal 2, js["users"].count
418 check_json_details(js["users"][0], user1, false, false)
419 check_json_details(js["users"][1], user3, false, false)
421 get api_users_path, :params => { :users => create(:user, :suspended).id }
422 assert_response :not_found
424 get api_users_path, :params => { :users => create(:user, :deleted).id }
425 assert_response :not_found
427 get api_users_path, :params => { :users => 0 }
428 assert_response :not_found
431 def test_index_oauth1
432 user1 = create(:user, :description => "test1", :terms_agreed => Date.yesterday)
433 user2 = create(:user, :description => "test2", :terms_agreed => Date.yesterday)
434 user3 = create(:user, :description => "test3", :terms_agreed => Date.yesterday)
435 good_token = create(:access_token, :user => user1, :allow_read_prefs => true)
436 bad_token = create(:access_token, :user => user1)
438 signed_get api_users_path, :params => { :users => user1.id }, :oauth => { :token => good_token }
439 assert_response :success
440 assert_equal "application/xml", response.media_type
441 assert_select "user", :count => 1 do
442 check_xml_details(user1, true, false)
443 assert_select "user[id='#{user2.id}']", :count => 0
444 assert_select "user[id='#{user3.id}']", :count => 0
447 signed_get api_users_path, :params => { :users => user2.id }, :oauth => { :token => good_token }
448 assert_response :success
449 assert_equal "application/xml", response.media_type
450 assert_select "user", :count => 1 do
451 assert_select "user[id='#{user1.id}']", :count => 0
452 check_xml_details(user2, false, false)
453 assert_select "user[id='#{user3.id}']", :count => 0
456 signed_get api_users_path, :params => { :users => "#{user1.id},#{user3.id}" }, :oauth => { :token => good_token }
457 assert_response :success
458 assert_equal "application/xml", response.media_type
459 assert_select "user", :count => 2 do
460 check_xml_details(user1, true, false)
461 assert_select "user[id='#{user2.id}']", :count => 0
462 check_xml_details(user3, false, false)
465 signed_get api_users_path, :params => { :users => "#{user1.id},#{user3.id}" }, :oauth => { :token => bad_token }
466 assert_response :success
467 assert_equal "application/xml", response.media_type
468 assert_select "user", :count => 2 do
469 check_xml_details(user1, false, false)
470 assert_select "user[id='#{user2.id}']", :count => 0
471 check_xml_details(user3, false, false)
474 signed_get api_users_path, :params => { :users => user1.id, :format => "json" }, :oauth => { :token => good_token }
475 assert_response :success
476 assert_equal "application/json", response.media_type
477 js = ActiveSupport::JSON.decode(@response.body)
479 assert_equal 1, js["users"].count
480 check_json_details(js["users"][0], user1, true, false)
482 signed_get api_users_path, :params => { :users => user2.id, :format => "json" }, :oauth => { :token => good_token }
483 assert_response :success
484 assert_equal "application/json", response.media_type
485 js = ActiveSupport::JSON.decode(@response.body)
487 assert_equal 1, js["users"].count
488 check_json_details(js["users"][0], user2, false, false)
490 signed_get api_users_path, :params => { :users => "#{user1.id},#{user3.id}", :format => "json" }, :oauth => { :token => good_token }
491 assert_response :success
492 assert_equal "application/json", response.media_type
493 js = ActiveSupport::JSON.decode(@response.body)
495 assert_equal 2, js["users"].count
496 check_json_details(js["users"][0], user1, true, false)
497 check_json_details(js["users"][1], user3, false, false)
499 signed_get api_users_path, :params => { :users => "#{user1.id},#{user3.id}", :format => "json" }, :oauth => { :token => bad_token }
500 assert_response :success
501 assert_equal "application/json", response.media_type
502 js = ActiveSupport::JSON.decode(@response.body)
504 assert_equal 2, js["users"].count
505 check_json_details(js["users"][0], user1, false, false)
506 check_json_details(js["users"][1], user3, false, false)
508 signed_get api_users_path, :params => { :users => create(:user, :suspended).id }, :oauth => { :token => good_token }
509 assert_response :not_found
511 signed_get api_users_path, :params => { :users => create(:user, :deleted).id }, :oauth => { :token => good_token }
512 assert_response :not_found
514 signed_get api_users_path, :params => { :users => 0 }, :oauth => { :token => good_token }
515 assert_response :not_found
518 def test_index_oauth2
519 user1 = create(:user, :description => "test1", :terms_agreed => Date.yesterday)
520 user2 = create(:user, :description => "test2", :terms_agreed => Date.yesterday)
521 user3 = create(:user, :description => "test3", :terms_agreed => Date.yesterday)
522 good_token = create(:oauth_access_token, :resource_owner_id => user1.id, :scopes => %w[read_prefs])
523 bad_token = create(:oauth_access_token, :resource_owner_id => user1.id, :scopes => %w[])
525 get api_users_path, :params => { :users => user1.id }, :headers => bearer_authorization_header(good_token.token)
526 assert_response :success
527 assert_equal "application/xml", response.media_type
528 assert_select "user", :count => 1 do
529 check_xml_details(user1, true, false)
530 assert_select "user[id='#{user2.id}']", :count => 0
531 assert_select "user[id='#{user3.id}']", :count => 0
534 get api_users_path, :params => { :users => user2.id }, :headers => bearer_authorization_header(good_token.token)
535 assert_response :success
536 assert_equal "application/xml", response.media_type
537 assert_select "user", :count => 1 do
538 assert_select "user[id='#{user1.id}']", :count => 0
539 check_xml_details(user2, false, false)
540 assert_select "user[id='#{user3.id}']", :count => 0
543 get api_users_path, :params => { :users => "#{user1.id},#{user3.id}" }, :headers => bearer_authorization_header(good_token.token)
544 assert_response :success
545 assert_equal "application/xml", response.media_type
546 assert_select "user", :count => 2 do
547 check_xml_details(user1, true, false)
548 assert_select "user[id='#{user2.id}']", :count => 0
549 check_xml_details(user3, false, false)
552 get api_users_path, :params => { :users => "#{user1.id},#{user3.id}" }, :headers => bearer_authorization_header(bad_token.token)
553 assert_response :success
554 assert_equal "application/xml", response.media_type
555 assert_select "user", :count => 2 do
556 check_xml_details(user1, false, false)
557 assert_select "user[id='#{user2.id}']", :count => 0
558 check_xml_details(user3, false, false)
561 get api_users_path, :params => { :users => user1.id, :format => "json" }, :headers => bearer_authorization_header(good_token.token)
562 assert_response :success
563 assert_equal "application/json", response.media_type
564 js = ActiveSupport::JSON.decode(@response.body)
566 assert_equal 1, js["users"].count
567 check_json_details(js["users"][0], user1, true, false)
569 get api_users_path, :params => { :users => user2.id, :format => "json" }, :headers => bearer_authorization_header(good_token.token)
570 assert_response :success
571 assert_equal "application/json", response.media_type
572 js = ActiveSupport::JSON.decode(@response.body)
574 assert_equal 1, js["users"].count
575 check_json_details(js["users"][0], user2, false, false)
577 get api_users_path, :params => { :users => "#{user1.id},#{user3.id}", :format => "json" }, :headers => bearer_authorization_header(good_token.token)
578 assert_response :success
579 assert_equal "application/json", response.media_type
580 js = ActiveSupport::JSON.decode(@response.body)
582 assert_equal 2, js["users"].count
583 check_json_details(js["users"][0], user1, true, false)
584 check_json_details(js["users"][1], user3, false, false)
586 get api_users_path, :params => { :users => "#{user1.id},#{user3.id}", :format => "json" }, :headers => bearer_authorization_header(bad_token.token)
587 assert_response :success
588 assert_equal "application/json", response.media_type
589 js = ActiveSupport::JSON.decode(@response.body)
591 assert_equal 2, js["users"].count
592 check_json_details(js["users"][0], user1, false, false)
593 check_json_details(js["users"][1], user3, false, false)
595 get api_users_path, :params => { :users => create(:user, :suspended).id }, :headers => bearer_authorization_header(good_token.token)
596 assert_response :not_found
598 get api_users_path, :params => { :users => create(:user, :deleted).id }, :headers => bearer_authorization_header(good_token.token)
599 assert_response :not_found
601 get api_users_path, :params => { :users => 0 }, :headers => bearer_authorization_header(good_token.token)
602 assert_response :not_found
607 trace1 = create(:trace, :user => user) do |trace|
608 create(:tracetag, :trace => trace, :tag => "London")
610 trace2 = create(:trace, :user => user) do |trace|
611 create(:tracetag, :trace => trace, :tag => "Birmingham")
613 # check that nothing is returned when not logged in
614 get user_gpx_files_path
615 assert_response :unauthorized
617 # check that we get a response when logged in
618 auth_header = basic_authorization_header user.email, "test"
619 get user_gpx_files_path, :headers => auth_header
620 assert_response :success
621 assert_equal "application/xml", response.media_type
623 # check the data that is returned
624 assert_select "gpx_file[id='#{trace1.id}']", 1 do
625 assert_select "tag", "London"
627 assert_select "gpx_file[id='#{trace2.id}']", 1 do
628 assert_select "tag", "Birmingham"
634 def check_xml_details(user, include_private, include_email)
635 assert_select "user[id='#{user.id}']", :count => 1 do
636 assert_select "description", :count => 1, :text => user.description
638 assert_select "contributor-terms", :count => 1 do
639 if user.terms_agreed.present?
640 assert_select "[agreed='true']", :count => 1
642 assert_select "[agreed='false']", :count => 1
646 assert_select "[pd='false']", :count => 1
648 assert_select "[pd]", :count => 0
652 assert_select "img", :count => 0
654 assert_select "roles", :count => 1 do
655 assert_select "role", :count => 0
658 assert_select "changesets", :count => 1 do
659 assert_select "[count='0']", :count => 1
662 assert_select "traces", :count => 1 do
663 assert_select "[count='0']", :count => 1
666 assert_select "blocks", :count => 1 do
667 assert_select "received", :count => 1 do
668 assert_select "[count='0'][active='0']", :count => 1
671 assert_select "issued", :count => 0
674 if include_private && user.home_lat.present? && user.home_lon.present?
675 assert_select "home", :count => 1 do
676 assert_select "[lat='12.1'][lon='23.4'][zoom='3']", :count => 1
679 assert_select "home", :count => 0
683 assert_select "languages", :count => 1 do
684 assert_select "lang", :count => user.languages.count
686 user.languages.each do |language|
687 assert_select "lang", :count => 1, :text => language
691 assert_select "messages", :count => 1 do
692 assert_select "received", :count => 1 do
693 assert_select "[count='#{user.messages.count}'][unread='0']", :count => 1
696 assert_select "sent", :count => 1 do
697 assert_select "[count='#{user.sent_messages.count}']", :count => 1
701 assert_select "languages", :count => 0
702 assert_select "messages", :count => 0
706 assert_select "email", :count => 1, :text => user.email
708 assert_select "email", :count => 0
713 def check_json_details(js, user, include_private, include_email)
714 assert_equal user.id, js["user"]["id"]
715 assert_equal user.description, js["user"]["description"]
716 assert js["user"]["contributor_terms"]["agreed"]
719 assert_not js["user"]["contributor_terms"]["pd"]
721 assert_nil js["user"]["contributor_terms"]["pd"]
724 assert_nil js["user"]["img"]
725 assert_empty js["user"]["roles"]
726 assert_equal 0, js["user"]["changesets"]["count"]
727 assert_equal 0, js["user"]["traces"]["count"]
728 assert_equal 0, js["user"]["blocks"]["received"]["count"]
729 assert_equal 0, js["user"]["blocks"]["received"]["active"]
730 assert_nil js["user"]["blocks"]["issued"]
732 if include_private && user.home_lat.present? && user.home_lon.present?
733 assert_in_delta 12.1, js["user"]["home"]["lat"]
734 assert_in_delta 23.4, js["user"]["home"]["lon"]
735 assert_equal 3, js["user"]["home"]["zoom"]
737 assert_nil js["user"]["home"]
740 if include_private && user.languages.present?
741 assert_equal user.languages, js["user"]["languages"]
743 assert_nil js["user"]["languages"]
747 assert_equal user.messages.count, js["user"]["messages"]["received"]["count"]
748 assert_equal 0, js["user"]["messages"]["received"]["unread"]
749 assert_equal user.sent_messages.count, js["user"]["messages"]["sent"]["count"]
751 assert_nil js["user"]["messages"]
755 assert_equal user.email, js["user"]["email"]
757 assert_nil js["user"]["email"]