File: go_md5_spec.rb

package info (click to toggle)
puppet-module-puppet-archive 4.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 688 kB
  • sloc: ruby: 2,152; sh: 30; makefile: 2
file content (18 lines) | stat: -rw-r--r-- 629 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'spec_helper'

describe :go_md5 do # rubocop:disable RSpec/DescribeSymbol
  before :all do # rubocop:disable RSpec/BeforeAfterAll
    Puppet::Parser::Functions.autoloader.loadall
  end

  let(:scope) { PuppetlabsSpec::PuppetInternals.scope }

  example_md5 = File.read(fixtures('checksum', 'gocd.md5'))

  it 'retreives file md5' do
    url = 'https://gocd.lan/path/file.md5'
    uri = URI(url)
    PuppetX::Bodeco::Util.stubs(:content).with(uri, username: 'user', password: 'pass').returns(example_md5)
    expect(scope.function_go_md5(['user', 'pass', 'filea', url])).to eq '283158c7da8c0ada74502794fa8745eb'
  end
end