From fd588cd715494092b5f55ac406f7dc69a1104ba9 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 1 Mar 2015 17:04:39 +0000 Subject: [PATCH] The test train rolls ever onwards... --- app/controllers/trace_controller.rb | 11 +- app/models/trace.rb | 3 - test/controllers/trace_controller_test.rb | 308 +++++++++++++++++- .../user_preference_controller_test.rb | 2 +- test/fixtures/gpx_files.yml | 13 + test/fixtures/user_preferences.yml | 10 + test/models/trace_test.rb | 13 +- test/models/user_preference_test.rb | 2 +- test/traces/1.gif | Bin 0 -> 408 bytes test/traces/10.gpx | 24 ++ test/traces/1_icon.gif | Bin 0 -> 84 bytes test/traces/2.gif | Bin 0 -> 408 bytes test/traces/2_icon.gif | Bin 0 -> 84 bytes test/traces/3.gif | Bin 0 -> 408 bytes test/traces/3_icon.gif | Bin 0 -> 84 bytes test/traces/4.gif | Bin 0 -> 408 bytes test/traces/4_icon.gif | Bin 0 -> 84 bytes test/traces/6.gif | Bin 0 -> 408 bytes test/traces/6_icon.gif | Bin 0 -> 84 bytes test/traces/7.gif | Bin 0 -> 408 bytes test/traces/7_icon.gif | Bin 0 -> 84 bytes test/traces/8.gif | Bin 0 -> 408 bytes test/traces/8_icon.gif | Bin 0 -> 84 bytes test/traces/9.gif | Bin 0 -> 408 bytes test/traces/9_icon.gif | Bin 0 -> 84 bytes 25 files changed, 362 insertions(+), 24 deletions(-) create mode 100644 test/traces/1.gif create mode 100644 test/traces/10.gpx create mode 100644 test/traces/1_icon.gif create mode 100644 test/traces/2.gif create mode 100644 test/traces/2_icon.gif create mode 100644 test/traces/3.gif create mode 100644 test/traces/3_icon.gif create mode 100644 test/traces/4.gif create mode 100644 test/traces/4_icon.gif create mode 100644 test/traces/6.gif create mode 100644 test/traces/6_icon.gif create mode 100644 test/traces/7.gif create mode 100644 test/traces/7_icon.gif create mode 100644 test/traces/8.gif create mode 100644 test/traces/8_icon.gif create mode 100644 test/traces/9.gif create mode 100644 test/traces/9_icon.gif diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index 64ecd5a7f..07a6fe210 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -117,7 +117,6 @@ class TraceController < ApplicationController end if @trace.id - logger.info("id is #{@trace.id}") flash[:notice] = t "trace.create.trace_uploaded" if @user.traces.where(:inserted => false).count > 4 @@ -219,7 +218,7 @@ class TraceController < ApplicationController def picture trace = Trace.find(params[:id]) - if trace.inserted? + if trace.visible? && trace.inserted? if trace.public? || (@user && @user == trace.user) expires_in 7.days, :private => !trace.public?, :public => trace.public? send_file(trace.large_picture_name, :filename => "#{trace.id}.gif", :type => "image/gif", :disposition => "inline") @@ -236,7 +235,7 @@ class TraceController < ApplicationController def icon trace = Trace.find(params[:id]) - if trace.inserted? + if trace.visible? && trace.inserted? if trace.public? || (@user && @user == trace.user) expires_in 7.days, :private => !trace.public?, :public => trace.public? send_file(trace.icon_picture_name, :filename => "#{trace.id}_icon.gif", :type => "image/gif", :disposition => "inline") @@ -295,11 +294,13 @@ class TraceController < ApplicationController end def api_data - trace = Trace.find(params[:id]) + trace = Trace.visible.find(params[:id]) if trace.public? || trace.user == @user - if request.format == Mime::XML || request.format == Mime::GPX + if request.format == Mime::XML send_file(trace.xml_file, :filename => "#{trace.id}.xml", :type => request.format.to_s, :disposition => "attachment") + elsif request.format == Mime::GPX + send_file(trace.xml_file, :filename => "#{trace.id}.gpx", :type => request.format.to_s, :disposition => "attachment") else send_file(trace.trace_name, :filename => "#{trace.id}#{trace.extension_name}", :type => trace.mime_type, :disposition => "attachment") end diff --git a/app/models/trace.rb b/app/models/trace.rb index 601a4506f..b13ce84d2 100644 --- a/app/models/trace.rb +++ b/app/models/trace.rb @@ -70,16 +70,13 @@ class Trace < ActiveRecord::Base def large_picture f = File.new(large_picture_name, "rb") - logger.info "large picture file: '#{f.path}', bytes: #{File.size(f.path)}" data = f.sysread(File.size(f.path)) - logger.info "have read data, bytes: '#{data.length}'" f.close data end def icon_picture f = File.new(icon_picture_name, "rb") - logger.info "icon picture file: '#{f.path}'" data = f.sysread(File.size(f.path)) f.close data diff --git a/test/controllers/trace_controller_test.rb b/test/controllers/trace_controller_test.rb index a61a47024..f9bcd1337 100644 --- a/test/controllers/trace_controller_test.rb +++ b/test/controllers/trace_controller_test.rb @@ -1,17 +1,23 @@ require "test_helper" class TraceControllerTest < ActionController::TestCase - fixtures :users, :gpx_files + fixtures :users, :user_preferences, :gpx_files set_fixture_class :gpx_files => Trace def setup @gpx_trace_dir = Object.send("remove_const", "GPX_TRACE_DIR") Object.const_set("GPX_TRACE_DIR", File.dirname(__FILE__) + "/../traces") + + @gpx_image_dir = Object.send("remove_const", "GPX_IMAGE_DIR") + Object.const_set("GPX_IMAGE_DIR", File.dirname(__FILE__) + "/../traces") end def teardown Object.send("remove_const", "GPX_TRACE_DIR") Object.const_set("GPX_TRACE_DIR", @gpx_trace_dir) + + Object.send("remove_const", "GPX_IMAGE_DIR") + Object.const_set("GPX_IMAGE_DIR", @gpx_image_dir) end ## @@ -162,11 +168,21 @@ class TraceControllerTest < ActionController::TestCase # Check that the list of changesets is displayed def test_list + # First with the public list get :list check_trace_list Trace.visible_to_all + # Restrict traces to those with a given tag get :list, :tag => "London" check_trace_list Trace.tagged("London").visible_to_all + + # Should see more when we are logged in + get :list, {}, { :user => users(:public_user).id } + check_trace_list Trace.visible_to(users(:public_user).id) + + # Again, we should see more when we are logged in + get :list, { :tag => "London" }, { :user => users(:public_user).id } + check_trace_list Trace.tagged("London").visible_to(users(:public_user).id) end # Check that I can get mine @@ -205,19 +221,28 @@ class TraceControllerTest < ActionController::TestCase # Should only see traces with the correct tag when a tag is specified get :list, { :display_name => users(:public_user).display_name, :tag => "London" }, { :user => users(:public_user).id } check_trace_list users(:public_user).traces.tagged("London") + + # Should get an error if the user does not exist + get :list, { :display_name => "UnknownUser" } + assert_response :not_found + assert_template "user/no_such_user" end # Check that the rss loads def test_rss + # First with the public feed get :georss, :format => :rss check_trace_feed Trace.visible_to_all + # Restrict traces to those with a given tag get :georss, :tag => "London", :format => :rss check_trace_feed Trace.tagged("London").visible_to_all + # Restrict traces to those for a given user get :georss, :display_name => users(:public_user).display_name, :format => :rss check_trace_feed users(:public_user).traces.visible_to_all + # Restrict traces to those for a given user with a tiven tag get :georss, :display_name => users(:public_user).display_name, :tag => "Birmingham", :format => :rss check_trace_feed users(:public_user).traces.tagged("Birmingham").visible_to_all end @@ -308,7 +333,7 @@ class TraceControllerTest < ActionController::TestCase get :data, :display_name => users(:public_user).display_name, :id => gpx_files(:anon_trace_file).id assert_response :not_found - # Now with some other user, which should work since the trace is anon + # Now with some other user, which shouldn't work since the trace is anon get :data, { :display_name => users(:public_user).display_name, :id => gpx_files(:anon_trace_file).id }, { :user => users(:normal_user).id } assert_response :not_found @@ -319,19 +344,161 @@ class TraceControllerTest < ActionController::TestCase # Test downloading a trace that doesn't exist def test_data_not_found - # First with no auth, which should work since the trace is public + # First with no auth and a trace that has never existed get :data, :display_name => users(:public_user).display_name, :id => 0 assert_response :not_found - # Now with some other user, which should work since the trace is public + # Now with a trace that has never existed get :data, { :display_name => users(:public_user).display_name, :id => 0 }, { :user => users(:public_user).id } assert_response :not_found - # And finally we should be able to do it with the owner of the trace + # Now with a trace that has been deleted get :data, { :display_name => users(:public_user).display_name, :id => 5 }, { :user => users(:public_user).id } assert_response :not_found end + # Test downloading the picture for a trace + def test_picture + # First with no auth, which should work since the trace is public + get :picture, :display_name => users(:normal_user).display_name, :id => gpx_files(:public_trace_file).id + check_trace_picture gpx_files(:public_trace_file) + + # Now with some other user, which should work since the trace is public + get :picture, { :display_name => users(:normal_user).display_name, :id => gpx_files(:public_trace_file).id }, { :user => users(:public_user).id } + check_trace_picture gpx_files(:public_trace_file) + + # And finally we should be able to do it with the owner of the trace + get :picture, { :display_name => users(:normal_user).display_name, :id => gpx_files(:public_trace_file).id }, { :user => users(:normal_user).id } + check_trace_picture gpx_files(:public_trace_file) + end + + # Check the picture for an anonymous trace can't be downloaded by another user + def test_picture_anon + # First with no auth + get :picture, :display_name => users(:public_user).display_name, :id => gpx_files(:anon_trace_file).id + assert_response :forbidden + + # Now with some other user, which shouldn't work since the trace is anon + get :picture, { :display_name => users(:public_user).display_name, :id => gpx_files(:anon_trace_file).id }, { :user => users(:normal_user).id } + assert_response :forbidden + + # And finally we should be able to do it with the owner of the trace + get :picture, { :display_name => users(:public_user).display_name, :id => gpx_files(:anon_trace_file).id }, { :user => users(:public_user).id } + check_trace_picture gpx_files(:anon_trace_file) + end + + # Test downloading the picture for a trace that doesn't exist + def test_picture_not_found + # First with no auth, which should work since the trace is public + get :picture, :display_name => users(:public_user).display_name, :id => 0 + assert_response :not_found + + # Now with some other user, which should work since the trace is public + get :picture, { :display_name => users(:public_user).display_name, :id => 0 }, { :user => users(:public_user).id } + assert_response :not_found + + # And finally we should be able to do it with the owner of the trace + get :picture, { :display_name => users(:public_user).display_name, :id => 5 }, { :user => users(:public_user).id } + assert_response :not_found + end + + # Test downloading the icon for a trace + def test_icon + # First with no auth, which should work since the trace is public + get :icon, :display_name => users(:normal_user).display_name, :id => gpx_files(:public_trace_file).id + check_trace_icon gpx_files(:public_trace_file) + + # Now with some other user, which should work since the trace is public + get :icon, { :display_name => users(:normal_user).display_name, :id => gpx_files(:public_trace_file).id }, { :user => users(:public_user).id } + check_trace_icon gpx_files(:public_trace_file) + + # And finally we should be able to do it with the owner of the trace + get :icon, { :display_name => users(:normal_user).display_name, :id => gpx_files(:public_trace_file).id }, { :user => users(:normal_user).id } + check_trace_icon gpx_files(:public_trace_file) + end + + # Check the icon for an anonymous trace can't be downloaded by another user + def test_icon_anon + # First with no auth + get :icon, :display_name => users(:public_user).display_name, :id => gpx_files(:anon_trace_file).id + assert_response :forbidden + + # Now with some other user, which shouldn't work since the trace is anon + get :icon, { :display_name => users(:public_user).display_name, :id => gpx_files(:anon_trace_file).id }, { :user => users(:normal_user).id } + assert_response :forbidden + + # And finally we should be able to do it with the owner of the trace + get :icon, { :display_name => users(:public_user).display_name, :id => gpx_files(:anon_trace_file).id }, { :user => users(:public_user).id } + check_trace_icon gpx_files(:anon_trace_file) + end + + # Test downloading the icon for a trace that doesn't exist + def test_icon_not_found + # First with no auth, which should work since the trace is public + get :icon, :display_name => users(:public_user).display_name, :id => 0 + assert_response :not_found + + # Now with some other user, which should work since the trace is public + get :icon, { :display_name => users(:public_user).display_name, :id => 0 }, { :user => users(:public_user).id } + assert_response :not_found + + # And finally we should be able to do it with the owner of the trace + get :icon, { :display_name => users(:public_user).display_name, :id => 5 }, { :user => users(:public_user).id } + assert_response :not_found + end + + # Test fetching the create page + def test_create_get + # First with no auth + get :create + assert_response :redirect + assert_redirected_to :controller => :user, :action => :login, :referer => trace_create_path + + # Now authenticated as a user with gps.trace.visibility set + get :create, {}, { :user => users(:public_user).id } + assert_response :success + assert_template :create + assert_select "select#trace_visibility option[value=identifiable][selected]", 1 + + # Now authenticated as a user with gps.trace.public set + get :create, {}, { :user => users(:second_public_user).id } + assert_response :success + assert_template :create + assert_select "select#trace_visibility option[value=public][selected]", 1 + + # Now authenticated as a user with no preferences + get :create, {}, { :user => users(:normal_user).id } + assert_response :success + assert_template :create + assert_select "select#trace_visibility option[value=private][selected]", 1 + end + + # Test creating a trace + def test_create_post + # Get file to use + file = Rack::Test::UploadedFile.new(gpx_files(:public_trace_file).trace_name, "application/gpx+xml") + + # First with no auth + post :create, { :trace => { :gpx_file => file, :description => "New Trace", :tagstring => "new,trace", :visibility => "trackable" } } + assert_response :forbidden + + # Now authenticated + assert_not_equal "trackable", users(:public_user).preferences.where(:k => "gps.trace.visibility").first.v + post :create, { :trace => { :gpx_file => file, :description => "New Trace", :tagstring => "new,trace", :visibility => "trackable" } }, { :user => users(:public_user).id } + assert_response :redirect + assert_redirected_to :action => :list, :display_name => users(:public_user).display_name + assert_match /file has been uploaded/, flash[:notice] + trace = Trace.order(:id => :desc).first + assert_equal "1.gpx", trace.name + assert_equal "New Trace", trace.description + assert_equal "new, trace", trace.tagstring + assert_equal "trackable", trace.visibility + assert_equal false, trace.inserted + assert_equal File.new(gpx_files(:public_trace_file).trace_name).read, File.new(trace.trace_name).read + trace.destroy + assert_equal "trackable", users(:public_user).preferences.where(:k => "gps.trace.visibility").first.v + end + # Test fetching the edit page for a trace def test_edit_get # First with no auth @@ -464,6 +631,118 @@ class TraceControllerTest < ActionController::TestCase assert_response :not_found end + # Test downloading a trace through the api + def test_api_data + # First with no auth + get :api_data, :display_name => users(:normal_user).display_name, :id => gpx_files(:public_trace_file).id + assert_response :unauthorized + + # Now with some other user, which should work since the trace is public + basic_authorization(users(:public_user).display_name, "test") + get :api_data, { :display_name => users(:normal_user).display_name, :id => gpx_files(:public_trace_file).id } + check_trace_data gpx_files(:public_trace_file) + + # And finally we should be able to do it with the owner of the trace + basic_authorization(users(:normal_user).display_name, "test") + get :api_data, { :display_name => users(:normal_user).display_name, :id => gpx_files(:public_trace_file).id } + check_trace_data gpx_files(:public_trace_file) + end + + # Test downloading a compressed trace through the api + def test_api_data_compressed + # Authenticate as the owner of the trace we will be using + basic_authorization(users(:public_user).display_name, "test") + + # First get the data as is + get :api_data, :display_name => users(:public_user).display_name, :id => gpx_files(:identifiable_trace_file).id + check_trace_data gpx_files(:identifiable_trace_file), "application/x-gzip", "gpx.gz" + + # Now ask explicitly for XML format + get :api_data, :display_name => users(:public_user).display_name, :id => gpx_files(:identifiable_trace_file).id, :format => "xml" + check_trace_data gpx_files(:identifiable_trace_file), "application/xml", "xml" + + # Now ask explicitly for GPX format + get :api_data, :display_name => users(:public_user).display_name, :id => gpx_files(:identifiable_trace_file).id, :format => "gpx" + check_trace_data gpx_files(:identifiable_trace_file) + end + + # Check an anonymous trace can't be downloaded by another user through the api + def test_api_data_anon + # First with no auth + get :api_data, :display_name => users(:public_user).display_name, :id => gpx_files(:anon_trace_file).id + assert_response :unauthorized + + # Now with some other user, which shouldn't work since the trace is anon + basic_authorization(users(:normal_user).display_name, "test") + get :api_data, { :display_name => users(:public_user).display_name, :id => gpx_files(:anon_trace_file).id } + assert_response :forbidden + + # And finally we should be able to do it with the owner of the trace + basic_authorization(users(:public_user).display_name, "test") + get :api_data, { :display_name => users(:public_user).display_name, :id => gpx_files(:anon_trace_file).id } + check_trace_data gpx_files(:anon_trace_file) + end + + # Test downloading a trace that doesn't exist through the api + def test_api_data_not_found + # First with no auth + get :api_data, :display_name => users(:public_user).display_name, :id => 0 + assert_response :unauthorized + + # Now with a trace that has never existed + basic_authorization(users(:public_user).display_name, "test") + get :api_data, { :display_name => users(:public_user).display_name, :id => 0 } + assert_response :not_found + + # Now with a trace that has been deleted + basic_authorization(users(:public_user).display_name, "test") + get :api_data, { :display_name => users(:public_user).display_name, :id => 5 } + assert_response :not_found + end + + # Test creating a trace through the api + def test_api_create + # Get file to use + file = Rack::Test::UploadedFile.new(gpx_files(:public_trace_file).trace_name, "application/gpx+xml") + + # First with no auth + post :api_create, { :file => file, :description => "New Trace", :tags => "new,trace", :visibility => "trackable" } + assert_response :unauthorized + + # Now authenticated + assert_not_equal "trackable", users(:public_user).preferences.where(:k => "gps.trace.visibility").first.v + basic_authorization(users(:public_user).display_name, "test") + post :api_create, { :file => file, :description => "New Trace", :tags => "new,trace", :visibility => "trackable" } + assert_response :success + trace = Trace.find(response.body.to_i) + assert_equal "1.gpx", trace.name + assert_equal "New Trace", trace.description + assert_equal "new, trace", trace.tagstring + assert_equal "trackable", trace.visibility + assert_equal false, trace.inserted + assert_equal File.new(gpx_files(:public_trace_file).trace_name).read, File.new(trace.trace_name).read + trace.destroy + assert_equal "trackable", users(:public_user).preferences.where(:k => "gps.trace.visibility").first.v + + # Rewind the file + file.rewind + + # Now authenticated, with the legacy public flag + assert_not_equal "private", users(:public_user).preferences.where(:k => "gps.trace.visibility").first.v + basic_authorization(users(:public_user).display_name, "test") + post :api_create, { :file => file, :description => "New Trace", :tags => "new,trace", :public => 0 } + assert_response :success + trace = Trace.find(response.body.to_i) + assert_equal "1.gpx", trace.name + assert_equal "New Trace", trace.description + assert_equal "new, trace", trace.tagstring + assert_equal "private", trace.visibility + assert_equal false, trace.inserted + assert_equal File.new(gpx_files(:public_trace_file).trace_name).read, File.new(trace.trace_name).read + trace.destroy + assert_equal "private", users(:public_user).preferences.where(:k => "gps.trace.visibility").first.v + end + # Check updating a trace through the api def test_api_update # First with no auth @@ -554,7 +833,7 @@ class TraceControllerTest < ActionController::TestCase assert_select item, "link", "http://test.host/user/#{trace.user.display_name}/traces/#{trace.id}" assert_select item, "guid", "http://test.host/user/#{trace.user.display_name}/traces/#{trace.id}" assert_select item, "description" - # assert_select item, "dc:creator", trace.user.display_name + # assert_select item, "dc:creator", trace.user.display_name assert_select item, "pubDate", trace.timestamp.rfc822 end end @@ -570,7 +849,8 @@ class TraceControllerTest < ActionController::TestCase assert_select "table#trace_list tbody", :count => 1 do assert_select "tr", :count => traces.visible.count do |rows| traces.visible.order("timestamp DESC").zip(rows).each do |trace, row| - assert_select row, "span.trace_summary", Regexp.new(Regexp.escape("(#{trace.size} points)")) + assert_select row, "a", Regexp.new(Regexp.escape(trace.name)) + assert_select row, "span.trace_summary", Regexp.new(Regexp.escape("(#{trace.size} points)")) if trace.inserted? assert_select row, "td", Regexp.new(Regexp.escape(trace.description)) assert_select row, "td", Regexp.new(Regexp.escape("by #{trace.user.display_name}")) end @@ -594,7 +874,19 @@ class TraceControllerTest < ActionController::TestCase def check_trace_data(trace, content_type = "application/gpx+xml", extension = "gpx") assert_response :success - assert_equal content_type, @response.content_type + assert_equal content_type, response.content_type assert_equal "attachment; filename=\"#{trace.id}.#{extension}\"", @response.header["Content-Disposition"] end + + def check_trace_picture(trace) + assert_response :success + assert_equal "image/gif", response.content_type + assert_equal trace.large_picture, response.body + end + + def check_trace_icon(trace) + assert_response :success + assert_equal "image/gif", response.content_type + assert_equal trace.icon_picture, response.body + end end diff --git a/test/controllers/user_preference_controller_test.rb b/test/controllers/user_preference_controller_test.rb index 3c36b29d1..752ec56cb 100644 --- a/test/controllers/user_preference_controller_test.rb +++ b/test/controllers/user_preference_controller_test.rb @@ -36,7 +36,7 @@ class UserPreferenceControllerTest < ActionController::TestCase assert_response :unauthorized, "should be authenticated" # authenticate as a user with no preferences - basic_authorization("test@example.com", "test") + basic_authorization("moderator@example.com", "test") # try the read again get :read diff --git a/test/fixtures/gpx_files.yml b/test/fixtures/gpx_files.yml index 4f4a82d98..4af266cf2 100644 --- a/test/fixtures/gpx_files.yml +++ b/test/fixtures/gpx_files.yml @@ -114,3 +114,16 @@ tar_bzip_trace_file: visibility: "private" description: This is a bzipped tarred trace inserted: true + +pending_trace_file: + id: 10 + user_id: 2 + visible: true + name: Pending Trace.gpx + size: 123 + latitude: 51.3 + longitude: -0.56 + timestamp: "2009-05-06 13:34:34" + visibility: "public" + description: This is a pending trace + inserted: false diff --git a/test/fixtures/user_preferences.yml b/test/fixtures/user_preferences.yml index 59ebd0542..03065a9eb 100644 --- a/test/fixtures/user_preferences.yml +++ b/test/fixtures/user_preferences.yml @@ -9,3 +9,13 @@ two: user_id: 1 k: "some_key" v: "some_value" + +u2_trace: + user_id: 2 + k: "gps.trace.visibility" + v: "identifiable" + +u3_trace: + user_id: 4 + k: "gps.trace.public" + v: "default" diff --git a/test/models/trace_test.rb b/test/models/trace_test.rb index 4be160959..85b258758 100644 --- a/test/models/trace_test.rb +++ b/test/models/trace_test.rb @@ -15,33 +15,34 @@ class TraceTest < ActiveSupport::TestCase end def test_trace_count - assert_equal 9, Trace.count + assert_equal 10, Trace.count end def test_visible check_query(Trace.visible, [ :public_trace_file, :anon_trace_file, :trackable_trace_file, :identifiable_trace_file, :zipped_trace_file, :tar_trace_file, - :tar_gzip_trace_file, :tar_bzip_trace_file + :tar_gzip_trace_file, :tar_bzip_trace_file, :pending_trace_file ]) end def test_visible_to check_query(Trace.visible_to(1), [ - :public_trace_file, :identifiable_trace_file + :public_trace_file, :identifiable_trace_file, :pending_trace_file ]) check_query(Trace.visible_to(2), [ :public_trace_file, :anon_trace_file, :trackable_trace_file, - :identifiable_trace_file + :identifiable_trace_file, :pending_trace_file ]) check_query(Trace.visible_to(3), [ - :public_trace_file, :identifiable_trace_file + :public_trace_file, :identifiable_trace_file, :pending_trace_file ]) end def test_visible_to_all check_query(Trace.visible_to_all, [ - :public_trace_file, :identifiable_trace_file, :deleted_trace_file + :public_trace_file, :identifiable_trace_file, + :deleted_trace_file, :pending_trace_file ]) end diff --git a/test/models/user_preference_test.rb b/test/models/user_preference_test.rb index da6cd7666..ee2dbf2d8 100644 --- a/test/models/user_preference_test.rb +++ b/test/models/user_preference_test.rb @@ -9,7 +9,7 @@ class UserPreferenceTest < ActiveSupport::TestCase # This test needs to be updated for every addition/deletion from # the fixture file def test_check_count - assert_equal 2, UserPreference.count + assert_equal 4, UserPreference.count end # Checks that you cannot add a new preference, that is a duplicate diff --git a/test/traces/1.gif b/test/traces/1.gif new file mode 100644 index 0000000000000000000000000000000000000000..da7254d2f6c2583d30e4d0322e8615dae42036bb GIT binary patch literal 408 zcmV;J0cZY4Nk%w1Vfq020FeLy00030|NpzYy8r+HA^!_bMO0HmK~P09E-(WD0000X z`2++q0RI3i00000`T+U>00RDukEzS;52Kv4+KaQ^y!#J^;z*X}iKgnxw(bkZ@=VwE zjpzE#_x=wI3Wvm^@rX<+m&~T~35`mp)T;H0&1$#YuJ;QLi^t@$`HW7h*X*|Y4Ufy` z^t%0y&+GU6zW)yxC^$%1Xn2U2sJO`3==ca3DLF}5X?cm6skzD7>G=s7DmqG9YI=&A zs=CVB>iP;BD?3YDYkP~EtGmnF>-!5FEIdqHY+LZGDZMt-a0N z?fnfNE!Lp z2r;6>i4-eZyofQQ##fCTJ9_*GGNj0nBukn+i87_il`LDjd + + + + + + + + 112.430000 + 0.072022 + 3d + 4 + 2.400000 + 2.600000 + 3.600000 + + + + diff --git a/test/traces/1_icon.gif b/test/traces/1_icon.gif new file mode 100644 index 0000000000000000000000000000000000000000..a92900be7943e4998c3c87363d3583834f034c15 GIT binary patch literal 84 zcmZ?wbh9u|G-5DfXkY+=|NsB%fM}2i1Cw!2|H{*E`4`XGa;t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