- test "reset fails with non-admin token" do
- post '/database/reset', {}, auth(:active)
- assert_response 403
+ slow_test "roll back database change" do
+ active_auth = auth(:active)
+ admin_auth = auth(:admin)
+
+ old_uuid = specimens(:owned_by_active_user).uuid
+ authorize_with :admin
+ post '/database/reset', params: {}, headers: admin_auth
+ assert_response :success
+
+ delete '/arvados/v1/specimens/' + old_uuid, params: {}, headers: active_auth
+ assert_response :success
+ post '/arvados/v1/specimens', params: {specimen: '{}'}, headers: active_auth
+ assert_response :success
+ new_uuid = json_response['uuid']
+
+ # Reset to fixtures.
+ post '/database/reset', params: {}, headers: admin_auth
+ assert_response :success
+
+ # New specimen should disappear. Old specimen should reappear.
+ get '/arvados/v1/specimens/'+new_uuid, params: {}, headers: active_auth
+ assert_response 404
+ get '/arvados/v1/specimens/'+old_uuid, params: {}, headers: active_auth
+ assert_response :success