+ uuid1 = api_fixture('jobs')['running']['uuid']
+ uuid2 = api_fixture('jobs')['running_cancelled']['uuid']
+
+ uuids = [uuid1, uuid2]
+ users = ac.send :preload_objects_for_dataclass, dataclass, uuids
+
+ assert users, 'Expected objects'
+ assert users.is_a?(Hash), 'Expected a hash'
+
+ assert users.size == 2, 'Expected two objects in the preloaded hash'
+ assert users[uuid1], 'Expected user object for the passed in uuid'
+ assert users[uuid2], 'Expected user object for the passed in uuid'
+
+ # invoke again for this same input. this time, the preloaded data will be returned
+ users = ac.send :preload_objects_for_dataclass, dataclass, uuids
+ assert users, 'Expected objects'
+ assert users.is_a?(Hash), 'Expected a hash'
+ assert users.size == 2, 'Expected two objects in the preloaded hash'
+
+ # invoke again for this with one more uuid
+ uuids << api_fixture('jobs')['foobar']['uuid']
+ users = ac.send :preload_objects_for_dataclass, dataclass, uuids
+ assert users, 'Expected objects'
+ assert users.is_a?(Hash), 'Expected a hash'
+ assert users.size == 3, 'Expected two objects in the preloaded hash'
+ end
+
+ test "requesting a nonexistent object returns 404" do
+ # We're really testing ApplicationController's find_object_by_uuid.
+ # It's easiest to do that by instantiating a concrete controller.
+ @controller = NodesController.new
+ get(:show, {id: "zzzzz-zzzzz-zzzzzzzzzzzzzzz"}, session_for(:admin))
+ assert_response 404