autosign 0.1.4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,51 +0,0 @@
1
- require 'spec_helper'
2
- require 'securerandom'
3
-
4
- context Autosign::Validators::Passwordlist do
5
- let(:certname) { 'host.example.com' }
6
- let(:validator) { Autosign::Validators::Passwordlist.new }
7
-
8
- before {
9
- # stub configuration
10
- data = { 'general' => {
11
- 'loglevel' => :debug,
12
- 'logfile' => '/tmp/autosign.log'
13
- },
14
- 'password_list' => {
15
- 'password' => ['hunter2', 'opensesame', 'CPE1704TKS']
16
- }
17
- }
18
- allow_any_instance_of(Autosign::Config).to receive(:settings).and_return(data)
19
- }
20
-
21
- context 'class methods' do
22
- describe '.new' do
23
- it 'requires no parameters' do
24
- expect { Autosign::Validators::Passwordlist.new() }.to_not raise_error
25
- end
26
- end
27
- end
28
-
29
- context 'instance methods' do
30
- describe '.name' do
31
- it 'returns a string' do
32
- expect(validator.name).to be_a(String)
33
- end
34
- it 'returns the string "password_list"' do
35
- expect(validator.name).to eq('password_list')
36
- end
37
- end
38
- describe '.validate' do
39
- it 'validates a request with a valid password' do
40
- expect(validator.validate('hunter2', 'foo.example.com', 'dummy_csr_data')).to be true
41
- expect(validator.validate('opensesame', 'foo.example.com', 'dummy_csr_data')).to be true
42
- expect(validator.validate('CPE1704TKS', 'foo.example.com', 'dummy_csr_data')).to be true
43
- end
44
- it 'does not validate a request with an invalid password' do
45
- expect(validator.validate('bad_password', 'foo.example.com', 'dummy_csr_data')).to be false
46
- expect(validator.validate('', 'foo.example.com', 'dummy_csr_data')).to be false
47
- end
48
- end
49
-
50
- end
51
- end