X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/fefce5e8e133a8fa064bbcdf31d85d41dc4a6729..d843787b4ece9952597d7814cbf10fb383c72625:/services/api/test/integration/collections_api_test.rb diff --git a/services/api/test/integration/collections_api_test.rb b/services/api/test/integration/collections_api_test.rb index b44c4bef5e..4251047cea 100644 --- a/services/api/test/integration/collections_api_test.rb +++ b/services/api/test/integration/collections_api_test.rb @@ -252,4 +252,46 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest }, auth(:active) assert_response 422 end + + [ + 'quick fox', + 'quick_brown fox', + 'brown_ fox', + 'fox dogs', + ].each do |search_filter| + test "full text search ignores special characters and finds with filter #{search_filter}" do + # description: The quick_brown_fox jumps over the lazy_dog + # full text search treats '_' as space apparently + get '/arvados/v1/collections', { + :filters => [['any', '@@', search_filter]].to_json + }, auth(:active) + assert_response 200 + response_items = json_response['items'] + assert_not_nil response_items + first_item = response_items.first + refute_empty first_item + assert_equal first_item['description'], 'The quick_brown_fox jumps over the lazy_dog' + end + end + + test "create and get collection with properties" do + # create collection to be searched for + signed_manifest = Collection.sign_manifest(". bad42fa702ae3ea7d888fef11b46f450+44 0:44:my_test_file.txt\n", api_token(:active)) + post "/arvados/v1/collections", { + format: :json, + collection: {manifest_text: signed_manifest}.to_json, + }, auth(:active) + assert_response 200 + assert_not_nil json_response['uuid'] + assert_not_nil json_response['properties'] + assert_empty json_response['properties'] + + # update collection's description + put "/arvados/v1/collections/#{json_response['uuid']}", { + format: :json, + collection: { properties: {'property_1' => 'value_1'} } + }, auth(:active) + assert_response :success + assert_equal 'value_1', json_response['properties']['property_1'] + end end