Merge remote-tracking branch 'upstream/pull/1614'

This commit is contained in:
Tom Hughes 2017-08-30 21:09:32 +01:00
commit f1faffd4d1
3 changed files with 29 additions and 24 deletions

View file

@ -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")