-
-
Notifications
You must be signed in to change notification settings - Fork 374
/
Copy pathrequirements_spec.rb
70 lines (58 loc) · 2.05 KB
/
requirements_spec.rb
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# frozen_string_literal: true
require 'spec_helper'
describe 'python::requirements', type: :define do
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
let :title do
'/requirements.txt'
end
context 'with /requirements.txt' do
let :params do
{
requirements: '/requirements.txt'
}
end
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_file('/requirements.txt').with_mode('0644') }
context 'with manage_requirements => false' do
let(:params) { super().merge(manage_requirements: false) }
it { is_expected.not_to contain_file('/requirements.txt') }
end
end
describe 'with owner' do
context 'bob:bob' do
let :params do
{
owner: 'bob',
group: 'bob'
}
end
it { is_expected.to compile.and_raise_error(%r{root user must be used when virtualenv is system}) }
end
end
context 'without parameters' do
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('python::config') }
it { is_expected.to contain_class('python::install') }
it { is_expected.to contain_class('python') }
it { is_expected.to contain_exec('python_requirements/requirements.txt') }
if facts[:os]['family'] == 'Archlinux'
it { is_expected.not_to contain_package('pip') }
else
it { is_expected.to contain_package('pip') }
end
it { is_expected.to contain_package('python') }
it { is_expected.to contain_package('gunicorn') }
it { is_expected.to contain_file('/requirements.txt').with_owner('root').with_group('root') }
if %w[Archlinux FreeBSD Gentoo].include?(facts[:os]['name'])
it { is_expected.not_to contain_package('python-dev') }
else
it { is_expected.to contain_package('python-dev') }
end
end
end
end
end