Add puppet/archive module
[mirror/dsa-puppet.git] / 3rdparty / modules / archive / spec / unit / puppet / parser / functions / go_md5_spec.rb
1 require 'spec_helper'
2
3 describe :go_md5 do # rubocop:disable RSpec/DescribeSymbol
4   before :all do # rubocop:disable RSpec/BeforeAfterAll
5     Puppet::Parser::Functions.autoloader.loadall
6   end
7
8   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
9
10   example_md5 = File.read(fixtures('checksum', 'gocd.md5'))
11
12   it 'retreives file md5' do
13     url = 'https://gocd.lan/path/file.md5'
14     uri = URI(url)
15     PuppetX::Bodeco::Util.stubs(:content).with(uri, username: 'user', password: 'pass').returns(example_md5)
16     expect(scope.function_go_md5(['user', 'pass', 'filea', url])).to eq '283158c7da8c0ada74502794fa8745eb'
17   end
18 end