+
+ get :list, :params => { :format => "html", :display_name => "Some random user", :list => "1" }, :xhr => true
+ assert_response :not_found
+ assert_template "user/no_such_user"
+ end
+
+ ##
+ # Checks the display of the friends changesets listing
+ def test_list_friends
+ private_user = create(:user, :data_public => true)
+ friend = create(:friend, :befriender => private_user)
+ create(:changeset, :user => friend.befriendee)
+
+ get :list, :params => { :friends => true }
+ assert_response :redirect
+ assert_redirected_to :controller => :user, :action => :login, :referer => friend_changesets_path
+
+ session[:user] = private_user.id
+
+ get :list, :params => { :friends => true }
+ assert_response :success
+ assert_template "history"
+
+ get :list, :params => { :friends => true, :list => "1" }, :xhr => true
+ assert_response :success
+ assert_template "list"
+
+ check_list_result(Changeset.where(:user => private_user.friend_users.identifiable))
+ end
+
+ ##
+ # Checks the display of the nearby user changesets listing
+ def test_list_nearby
+ private_user = create(:user, :data_public => false, :home_lat => 51.1, :home_lon => 1.0)
+ user = create(:user, :home_lat => 51.0, :home_lon => 1.0)
+ create(:changeset, :user => user)
+
+ get :list, :params => { :nearby => true }
+ assert_response :redirect
+ assert_redirected_to :controller => :user, :action => :login, :referer => nearby_changesets_path
+
+ session[:user] = private_user.id
+
+ get :list, :params => { :nearby => true }
+ assert_response :success
+ assert_template "history"
+
+ get :list, :params => { :nearby => true, :list => "1" }, :xhr => true
+ assert_response :success
+ assert_template "list"
+
+ check_list_result(Changeset.where(:user => user.nearby))