X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/6fe5d4210099e714586bdcb5e7447c321afdfdc4..4f20850e55928c7c06c81021974ede0b3b84422f:/test/controllers/trace_controller_test.rb?ds=sidebyside diff --git a/test/controllers/trace_controller_test.rb b/test/controllers/trace_controller_test.rb index 4610852fb..a23b59473 100644 --- a/test/controllers/trace_controller_test.rb +++ b/test/controllers/trace_controller_test.rb @@ -931,6 +931,23 @@ class TraceControllerTest < ActionController::TestCase assert_equal nt.visibility, t.visibility end + # Test that updating a trace doesn't duplicate the tags + def test_api_update_tags + tracetag = create(:tracetag) + trace = tracetag.trace + basic_authorization trace.user.display_name, "test" + + content trace.to_xml + put :api_update, :params => { :id => trace.id } + assert_response :success + + updated = Trace.find(trace.id) + # Ensure there's only one tag in the database after updating + assert_equal Tracetag.count, 1 + # The new tag object might have a different id, so check the string representation + assert_equal trace.tagstring, updated.tagstring + end + # Check deleting a trace through the api def test_api_delete public_trace_file = create(:trace, :visibility => "public")