Debian Codegraph @

spec/type_aliases/sshkey_spec.rb

raw
1 require 'spec_helper'
2
3 describe 'Nova::SshKey' do
4 describe 'valid types' do
5 context 'with valid types' do
6 [
7 {'key' => 'foo', 'type' => 'ssh-rsa'},
8 {'key' => 'foo', 'type' => 'ssh-dsa'},
9 {'key' => 'foo', 'type' => 'ssh-ecdsa'},
10 {'key' => 'foo', 'type' => 'ssh-ed25519'},
11 ].each do |value|
12 describe value.inspect do
13 it { is_expected.to allow_value(value) }
14 end
15 end
16 end
17 end
18
19 describe 'invalid types' do
20 context 'with garbage inputs' do
21 [
22 {},
23 {'key' => 'foo'},
24 {'type' => 'ssh-rsa'},
25 {'key' => 'foo', 'type' => 'ssh-invalid'},
26 {'key' => '', 'type' => 'ssh-rsa'},
27 {'key' => 1, 'type' => 'ssh-rsa'},
28 nil,
29 '<SERVICE DEFAULT>',
30 ].each do |value|
31 describe value.inspect do
32 it { is_expected.not_to allow_value(value) }
33 end
34 end
35 end
36 end
37 end