- # Test adding and removing multiple tags with multiple objects.
- def test_multi_tag_multi_objects
- out, err = capture_subprocess_io do
- assert arv_tag('add', 'test_tag1', 'test_tag2', 'test_tag3',
- '--object', 'uuid1',
- '--object', 'uuid2',
- '--object', 'uuid3')
- end
-
- out, err = capture_subprocess_io do
- assert arv '-h', 'link', 'list', '--where', '{"link_class":"tag"}'
- end
-
- assert_empty err
- json_out = JSON.parse out
- links = json_out['items'].sort { |a,b|
- a['name'] <=> b['name'] or
- a['head_uuid'] <=> b['head_uuid']
- }
-
- assert_equal 'test_tag1', links[0]['name']
- assert_equal 'tag', links[0]['link_class']
- assert_equal 'uuid1', links[0]['head_uuid']
- assert_equal 'test_tag1', links[1]['name']
- assert_equal 'tag', links[1]['link_class']
- assert_equal 'uuid2', links[1]['head_uuid']
- assert_equal 'test_tag1', links[2]['name']
- assert_equal 'tag', links[2]['link_class']
- assert_equal 'uuid3', links[2]['head_uuid']
-
- assert_equal 'test_tag2', links[3]['name']
- assert_equal 'tag', links[3]['link_class']
- assert_equal 'uuid1', links[3]['head_uuid']
- assert_equal 'test_tag2', links[4]['name']
- assert_equal 'tag', links[4]['link_class']
- assert_equal 'uuid2', links[4]['head_uuid']
- assert_equal 'test_tag2', links[5]['name']
- assert_equal 'tag', links[5]['link_class']
- assert_equal 'uuid3', links[5]['head_uuid']
-
- assert_equal 'test_tag3', links[6]['name']
- assert_equal 'tag', links[6]['link_class']
- assert_equal 'uuid1', links[6]['head_uuid']
- assert_equal 'test_tag3', links[7]['name']
- assert_equal 'tag', links[7]['link_class']
- assert_equal 'uuid2', links[7]['head_uuid']
- assert_equal 'test_tag3', links[8]['name']
- assert_equal 'tag', links[8]['link_class']
- assert_equal 'uuid3', links[8]['head_uuid']
-
- end
-