+ context 'with entries for /etc/apt/auth.conf' do
+ let(:params) do
+ {
+ auth_conf_entries: [
+ { machine: 'deb.example.net',
+ login: 'foologin',
+ password: 'secret' },
+ { machine: 'apt.example.com',
+ login: 'aptlogin',
+ password: 'supersecret' },
+ ],
+ }
+ end
+
+ auth_conf_content = "// This file is managed by Puppet. DO NOT EDIT.
+machine deb.example.net login foologin password secret
+machine apt.example.com login aptlogin password supersecret
+"
+
+ it {
+ is_expected.to contain_file('/etc/apt/auth.conf').with(ensure: 'present',
+ owner: 'root',
+ group: 'root',
+ mode: '0600',
+ notify: 'Class[Apt::Update]',
+ content: auth_conf_content)
+ }
+ end
+
+ context 'with improperly specified entries for /etc/apt/auth.conf' do
+ let(:params) do
+ {
+ auth_conf_entries: [
+ { machinn: 'deb.example.net',
+ username: 'foologin',
+ password: 'secret' },
+ { machine: 'apt.example.com',
+ login: 'aptlogin',
+ password: 'supersecret' },
+ ],
+ }
+ end
+
+ it { is_expected.to raise_error(Puppet::Error) }
+ end
+