/usr/lib/ruby/vendor_ruby/fog/test_helpers/model_helper.rb is in ruby-fog-core 1.22.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | def model_tests(collection, params = {}, mocks_implemented = true)
tests('success') do
@instance = collection.new(params)
tests("#save").succeeds do
pending if Fog.mocking? && !mocks_implemented
@instance.save
end
if block_given?
yield
end
tests("#destroy").succeeds do
pending if Fog.mocking? && !mocks_implemented
@instance.destroy
end
end
end
# Generates a unique identifier with a random differentiator.
# Useful when rapidly re-running tests, so we don't have to wait
# serveral minutes for deleted objects to disappear from the API
# E.g. 'fog-test-1234'
def uniq_id(base_name = 'fog-test')
# random_differentiator
suffix = rand(65536).to_s(16).rjust(4, '0')
[base_name, suffix] * '-'
end
|