node = create(:node)
## First try with a non-public user, which should get a forbidden
- basic_authorization(create(:user, :data_public => false).email, "test")
+ basic_authorization create(:user, :data_public => false).email, "test"
# create a temporary changeset
content "<osm><changeset>" +
assert_response :forbidden
## Now try with a normal user
- basic_authorization(create(:user).email, "test")
+ basic_authorization create(:user).email, "test"
# create a temporary changeset
content "<osm><changeset>" +
#
# NOTE: the error turned out to be something else completely!
def test_josm_upload
- basic_authorization(create(:user).email, "test")
+ basic_authorization create(:user).email, "test"
# create a temporary changeset
content "<osm><changeset>" +
node = create(:node)
node2 = create(:node)
way = create(:way)
- basic_authorization(create(:user).email, "test")
+ basic_authorization create(:user).email, "test"
# create a temporary changeset
content "<osm><changeset>" +
deleted_user = create(:user, :deleted)
private_user_closed_changeset = create(:changeset, :closed, :user => private_user)
- basic_authorization(user.email, "test")
+ basic_authorization user.email, "test"
assert_difference "ChangesetComment.count", 1 do
assert_no_difference "ActionMailer::Base.deliveries.size" do
ActionMailer::Base.deliveries.clear
- basic_authorization(user2.email, "test")
+ basic_authorization user2.email, "test"
assert_difference "ChangesetComment.count", 1 do
assert_difference "ActionMailer::Base.deliveries.size", 2 do
post :comment, :params => { :id => create(:changeset, :closed).id, :text => "This is a comment" }
assert_response :unauthorized
- basic_authorization(create(:user).email, "test")
+ basic_authorization create(:user).email, "test"
# bad changeset id
assert_no_difference "ChangesetComment.count" do
##
# test subscribe success
def test_subscribe_success
- basic_authorization(create(:user).email, "test")
+ basic_authorization create(:user).email, "test"
changeset = create(:changeset, :closed)
assert_difference "changeset.subscribers.count", 1 do
end
assert_response :unauthorized
- basic_authorization(user.email, "test")
+ basic_authorization user.email, "test"
# bad changeset id
assert_no_difference "changeset.subscribers.count" do
# test unsubscribe success
def test_unsubscribe_success
user = create(:user)
- basic_authorization(user.email, "test")
+ basic_authorization user.email, "test"
changeset = create(:changeset, :closed)
changeset.subscribers.push(user)
end
assert_response :unauthorized
- basic_authorization(create(:user).email, "test")
+ basic_authorization create(:user).email, "test"
# bad changeset id
assert_no_difference "changeset.subscribers.count" do
assert_response :unauthorized
assert_equal true, comment.reload.visible
- basic_authorization(create(:user).email, "test")
+ basic_authorization create(:user).email, "test"
# not a moderator
post :hide_comment, :params => { :id => comment.id }
assert_response :forbidden
assert_equal true, comment.reload.visible
- basic_authorization(create(:moderator_user).email, "test")
+ basic_authorization create(:moderator_user).email, "test"
# bad comment id
post :hide_comment, :params => { :id => 999111 }
comment = create(:changeset_comment)
assert_equal true, comment.visible
- basic_authorization(create(:moderator_user).email, "test")
+ basic_authorization create(:moderator_user).email, "test"
post :hide_comment, :params => { :id => comment.id }
assert_response :success
assert_response :unauthorized
assert_equal false, comment.reload.visible
- basic_authorization(create(:user).email, "test")
+ basic_authorization create(:user).email, "test"
# not a moderator
post :unhide_comment, :params => { :id => comment.id }
assert_response :forbidden
assert_equal false, comment.reload.visible
- basic_authorization(create(:moderator_user).email, "test")
+ basic_authorization create(:moderator_user).email, "test"
# bad comment id
post :unhide_comment, :params => { :id => 999111 }
comment = create(:changeset_comment, :visible => false)
assert_equal false, comment.visible
- basic_authorization(create(:moderator_user).email, "test")
+ basic_authorization create(:moderator_user).email, "test"
post :unhide_comment, :params => { :id => comment.id }
assert_response :success