Update tests to set the username cookie as necessary
This commit is contained in:
parent
9e2132b83d
commit
33fb432beb
3 changed files with 15 additions and 1 deletions
|
@ -6,6 +6,8 @@ class DiaryEntryControllerTest < ActionController::TestCase
|
||||||
include ActionView::Helpers::NumberHelper
|
include ActionView::Helpers::NumberHelper
|
||||||
|
|
||||||
def test_showing_new_diary_entry
|
def test_showing_new_diary_entry
|
||||||
|
@request.cookies["_osm_username"] = users(:normal_user).display_name
|
||||||
|
|
||||||
get :new
|
get :new
|
||||||
assert_response :redirect
|
assert_response :redirect
|
||||||
assert_redirected_to :controller => :user, :action => "login", :referer => "/diary/new"
|
assert_redirected_to :controller => :user, :action => "login", :referer => "/diary/new"
|
||||||
|
@ -39,6 +41,8 @@ class DiaryEntryControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_editing_diary_entry
|
def test_editing_diary_entry
|
||||||
|
@request.cookies["_osm_username"] = users(:normal_user).display_name
|
||||||
|
|
||||||
# Make sure that you are redirected to the login page when you are
|
# Make sure that you are redirected to the login page when you are
|
||||||
# not logged in, without and with the id of the entry you want to edit
|
# not logged in, without and with the id of the entry you want to edit
|
||||||
get :edit
|
get :edit
|
||||||
|
@ -120,6 +124,8 @@ class DiaryEntryControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@request.cookies["_osm_username"] = users(:public_user).display_name
|
||||||
|
|
||||||
# and when not logged in as the user who wrote the entry
|
# and when not logged in as the user who wrote the entry
|
||||||
get :view, {:id => diary_entries(:normal_user_entry_1).id, :display_name => 'test'}, {'user' => users(:public_user).id}
|
get :view, {:id => diary_entries(:normal_user_entry_1).id, :display_name => 'test'}, {'user' => users(:public_user).id}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
@ -148,6 +154,8 @@ class DiaryEntryControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_edit_diary_entry_i18n
|
def test_edit_diary_entry_i18n
|
||||||
|
@request.cookies["_osm_username"] = users(:normal_user).display_name
|
||||||
|
|
||||||
get(:edit, {:id => diary_entries(:normal_user_entry_1).id}, {'user' => users(:normal_user).id})
|
get(:edit, {:id => diary_entries(:normal_user_entry_1).id}, {'user' => users(:normal_user).id})
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select "span[class=translation_missing]", false, "Missing translation in edit diary entry"
|
assert_select "span[class=translation_missing]", false, "Missing translation in edit diary entry"
|
||||||
|
|
|
@ -43,6 +43,8 @@ class SiteControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
# test the right editor gets used when the user hasn't set a preference
|
# test the right editor gets used when the user hasn't set a preference
|
||||||
def test_edit_without_preference
|
def test_edit_without_preference
|
||||||
|
@request.cookies["_osm_username"] = users(:public_user).display_name
|
||||||
|
|
||||||
get(:edit, nil, { 'user' => users(:public_user).id })
|
get(:edit, nil, { 'user' => users(:public_user).id })
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template :partial => "_#{DEFAULT_EDITOR}", :count => 1
|
assert_template :partial => "_#{DEFAULT_EDITOR}", :count => 1
|
||||||
|
@ -50,6 +52,8 @@ class SiteControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
# and when they have...
|
# and when they have...
|
||||||
def test_edit_with_preference
|
def test_edit_with_preference
|
||||||
|
@request.cookies["_osm_username"] = users(:public_user).display_name
|
||||||
|
|
||||||
user = users(:public_user)
|
user = users(:public_user)
|
||||||
user.preferred_editor = "potlatch"
|
user.preferred_editor = "potlatch"
|
||||||
user.save!
|
user.save!
|
||||||
|
|
|
@ -13,6 +13,8 @@ class TraceControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
# Check that I can get mine
|
# Check that I can get mine
|
||||||
def test_list_mine
|
def test_list_mine
|
||||||
|
@request.cookies["_osm_username"] = users(:public_user).display_name
|
||||||
|
|
||||||
# First try to get it when not logged in
|
# First try to get it when not logged in
|
||||||
get :mine
|
get :mine
|
||||||
assert_redirected_to :controller => 'user', :action => 'login', :referer => '/traces/mine'
|
assert_redirected_to :controller => 'user', :action => 'login', :referer => '/traces/mine'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue