assert_response :success
assert_nil assigns(:objects)
- get :show, {
- id: test_collection[:portable_data_hash]
- }
- assert_response :success
- assert_not_nil assigns(:object)
- resp = JSON.parse(@response.body)
- assert_equal test_collection[:portable_data_hash], resp['portable_data_hash']
+ created = JSON.parse(@response.body)
+
+ retrieved_collection = Collection.select([:uuid, :portable_data_hash, :manifest_text]).
+ where(portable_data_hash: created['portable_data_hash']).first
+
+ assert_equal test_collection[:portable_data_hash], retrieved_collection['portable_data_hash']
# The manifest in the response will have had permission hints added.
# Remove any permission hints in the response before comparing it to the source.
- stripped_manifest = resp['manifest_text'].gsub(/\+A[A-Za-z0-9@_-]+/, '')
+ stripped_manifest = retrieved_collection['manifest_text'].gsub(/\+A[A-Za-z0-9@_-]+/, '')
assert_equal test_collection[:manifest_text], stripped_manifest
end
class Arvados::V1::LinksControllerTest < ActionController::TestCase
- test "no symbol keys in serialized hash" do
- link = {
- properties: {username: 'testusername'},
- link_class: 'test',
- name: 'encoding',
- tail_uuid: users(:admin).uuid,
- head_uuid: virtual_machines(:testvm).uuid
- }
- authorize_with :admin
- [link, link.to_json].each do |formatted_link|
- post :create, link: formatted_link
+ ['link', 'link_json'].each do |formatted_link|
+ test "no symbol keys in serialized hash #{formatted_link}" do
+ link = {
+ properties: {username: 'testusername'},
+ link_class: 'test',
+ name: 'encoding',
+ tail_uuid: users(:admin).uuid,
+ head_uuid: virtual_machines(:testvm).uuid
+ }
+ authorize_with :admin
+ if formatted_link == 'link_json'
+ post :create, link: link.to_json
+ else
+ post :create, link: link
+ end
assert_response :success
assert_not_nil assigns(:object)
assert_equal 'testusername', assigns(:object).properties['username']