netscaler 0.5.2 → 0.6.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.
- checksums.yaml +8 -8
- data/Gemfile +5 -5
- data/Gemfile.lock +42 -29
- data/VERSION +1 -1
- data/lib/netscaler/connection.rb +6 -0
- data/lib/netscaler/cs/vserver/bind.rb +6 -0
- data/lib/netscaler/lb/monitor.rb +28 -0
- data/lib/netscaler/servicegroup.rb +4 -1
- data/lib/netscaler/ssl.rb +17 -0
- data/lib/netscaler/ssl/vserver.rb +55 -0
- data/lib/netscaler/ssl/vserver/bind.rb +21 -0
- data/lib/netscaler/ssl/vserver/unbind.rb +18 -0
- data/netscaler.gemspec +25 -20
- data/spec/csvserver_spec.rb +36 -36
- data/spec/lbvserver_spec.rb +29 -29
- data/spec/netscaler_spec.rb +5 -5
- data/spec/policy_stringmap_spec.rb +11 -11
- data/spec/responder_spec.rb +8 -8
- data/spec/rewrite_spec.rb +8 -8
- data/spec/server_spec.rb +12 -12
- data/spec/service_spec.rb +5 -5
- data/spec/servicegroup_spec.rb +17 -17
- data/spec/sslvserver_spec.rb +131 -0
- metadata +20 -15
@@ -10,41 +10,41 @@ describe Netscaler::Policy::Stringmap do
|
|
10
10
|
specify 'a name is required' do
|
11
11
|
expect {
|
12
12
|
connection.policy.stringmap.add('test')
|
13
|
-
}.
|
13
|
+
}.to raise_error(ArgumentError, /payload must be a hash\./)
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'returns a hash if proper arguments are passed' do
|
17
17
|
result = connection.policy.stringmap.add(:name => 'test')
|
18
|
-
result.
|
18
|
+
expect(result).to be_kind_of(Hash)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
context 'when getting a list of stringmaps' do
|
23
23
|
specify 'a name is optional' do
|
24
24
|
result = connection.policy.stringmap.list(:name => 'test')
|
25
|
-
result.
|
25
|
+
expect(result).to be_kind_of(Hash)
|
26
26
|
end
|
27
27
|
|
28
28
|
specify 'the arg should be a hash' do
|
29
29
|
expect {
|
30
30
|
connection.policy.stringmap.list('test')
|
31
|
-
}.
|
31
|
+
}.to raise_error(ArgumentError, /payload must be a hash\./)
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'returns a hash, listing stringmaps' do
|
35
35
|
result = connection.policy.stringmap.list
|
36
|
-
result.
|
36
|
+
expect(result).to be_kind_of(Hash)
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'Method Get will take name parameter and return hash' do
|
40
40
|
result = connection.policy.stringmap.get(:name => 'test')
|
41
|
-
result.
|
41
|
+
expect(result).to be_kind_of(Hash)
|
42
42
|
end
|
43
43
|
|
44
44
|
specify 'Method Get, arg should be a hash' do
|
45
45
|
expect {
|
46
46
|
connection.policy.stringmap.get('test')
|
47
|
-
}.
|
47
|
+
}.to raise_error(ArgumentError, /payload must be a hash\./)
|
48
48
|
end
|
49
49
|
|
50
50
|
end
|
@@ -53,24 +53,24 @@ describe Netscaler::Policy::Stringmap do
|
|
53
53
|
specify 'a name is required' do
|
54
54
|
expect {
|
55
55
|
connection.policy.stringmap.bind(:key => 'foo', :value => 'bar')
|
56
|
-
}.
|
56
|
+
}.to raise_error(ArgumentError, /name/)
|
57
57
|
end
|
58
58
|
|
59
59
|
specify 'a key is required' do
|
60
60
|
expect {
|
61
61
|
connection.policy.stringmap.bind(:name => 'foo', :value => 'bar')
|
62
|
-
}.
|
62
|
+
}.to raise_error(ArgumentError, /key/)
|
63
63
|
end
|
64
64
|
|
65
65
|
specify 'a value is required' do
|
66
66
|
expect {
|
67
67
|
connection.policy.stringmap.bind(:key => 'foo', :name => 'bar')
|
68
|
-
}.
|
68
|
+
}.to raise_error(ArgumentError, /value/)
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'returns a hash if proper arguments are passed' do
|
72
72
|
result = connection.policy.stringmap.bind(:name => 'test', :key => 'foo', :value => 'bar')
|
73
|
-
result.
|
73
|
+
expect(result).to be_kind_of(Hash)
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
data/spec/responder_spec.rb
CHANGED
@@ -10,24 +10,24 @@ describe Netscaler::Responder::Action do
|
|
10
10
|
context 'when using the show method in Responder::Action' do
|
11
11
|
it 'with no param used it will return all responder actions' do
|
12
12
|
result = connection.responder.action.show
|
13
|
-
result.
|
13
|
+
expect(result).to be_kind_of(Hash)
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'supplying the name parameter will return Hash' do
|
17
17
|
result = connection.responder.action.show :name => 'foo'
|
18
|
-
result.
|
18
|
+
expect(result).to be_kind_of(Hash)
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'when showing a particular responder action, string is invalid' do
|
22
22
|
expect {
|
23
23
|
connection.responder.action.show('asdf')
|
24
|
-
}.
|
24
|
+
}.to raise_error(TypeError, /conver(t|sion)/)
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'when showing a particular responder action :name is required' do
|
28
28
|
expect {
|
29
29
|
connection.responder.action.show(:foo => 'bar')
|
30
|
-
}.
|
30
|
+
}.to raise_error(ArgumentError, /name/)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -40,24 +40,24 @@ describe Netscaler::Responder::Policy do
|
|
40
40
|
context 'when using the show method in Responder::Policy' do
|
41
41
|
it 'with no param used it will return all responder policies' do
|
42
42
|
result = connection.responder.policy.show
|
43
|
-
result.
|
43
|
+
expect(result).to be_kind_of(Hash)
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'supplying the name parameter will return Hash' do
|
47
47
|
result = connection.responder.policy.show :name => 'foo'
|
48
|
-
result.
|
48
|
+
expect(result).to be_kind_of(Hash)
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'when showing a particular responder policy, string is invalid' do
|
52
52
|
expect {
|
53
53
|
connection.responder.policy.show('asdf')
|
54
|
-
}.
|
54
|
+
}.to raise_error(TypeError, /conver(t|sion)/)
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'when showing a particular responder policy :name is required' do
|
58
58
|
expect {
|
59
59
|
connection.responder.policy.show(:foo => 'bar')
|
60
|
-
}.
|
60
|
+
}.to raise_error(ArgumentError, /name/)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
data/spec/rewrite_spec.rb
CHANGED
@@ -10,24 +10,24 @@ describe Netscaler::Rewrite::Action do
|
|
10
10
|
context 'when using the show method in Rewrite::Action' do
|
11
11
|
it 'with no param used it will return all rewrite actions' do
|
12
12
|
result = connection.rewrite.action.show
|
13
|
-
result.
|
13
|
+
expect(result).to be_kind_of(Hash)
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'supplying the name parameter will return Hash' do
|
17
17
|
result = connection.rewrite.action.show :name => 'foo'
|
18
|
-
result.
|
18
|
+
expect(result).to be_kind_of(Hash)
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'when showing a particular rewrite action, string is invalid' do
|
22
22
|
expect {
|
23
23
|
connection.rewrite.action.show('asdf')
|
24
|
-
}.
|
24
|
+
}.to raise_error(TypeError, /conver(t|sion)/)
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'when showing a particular rewrite action :name is required' do
|
28
28
|
expect {
|
29
29
|
connection.rewrite.action.show(:foo => 'bar')
|
30
|
-
}.
|
30
|
+
}.to raise_error(ArgumentError, /name/)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -40,24 +40,24 @@ describe Netscaler::Rewrite::Policy do
|
|
40
40
|
context 'when using the show method in Rewrite::Policy' do
|
41
41
|
it 'with no param used it will return all rewrite policies' do
|
42
42
|
result = connection.rewrite.policy.show
|
43
|
-
result.
|
43
|
+
expect(result).to be_kind_of(Hash)
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'supplying the name parameter will return Hash' do
|
47
47
|
result = connection.rewrite.policy.show :name => 'foo'
|
48
|
-
result.
|
48
|
+
expect(result).to be_kind_of(Hash)
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'when showing a particular rewrite policy, string is invalid' do
|
52
52
|
expect {
|
53
53
|
connection.rewrite.policy.show('asdf')
|
54
|
-
}.
|
54
|
+
}.to raise_error(TypeError, /conver(t|sion)/)
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'when showing a particular rewrite policy :name is required' do
|
58
58
|
expect {
|
59
59
|
connection.rewrite.policy.show(:foo => 'bar')
|
60
|
-
}.
|
60
|
+
}.to raise_error(ArgumentError, /name/)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
data/spec/server_spec.rb
CHANGED
@@ -10,18 +10,18 @@ describe Netscaler::Server do
|
|
10
10
|
it 'a name is required' do
|
11
11
|
expect {
|
12
12
|
connection.servers.add({'ipaddress'=>'123.123.123.123'})
|
13
|
-
}.
|
13
|
+
}.to raise_error(ArgumentError, /name/)
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'an ipaddress is required' do
|
17
17
|
expect {
|
18
18
|
connection.servers.add({'name'=>'hostname'})
|
19
|
-
}.
|
19
|
+
}.to raise_error(ArgumentError, /ipaddress/)
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'returns a Hash object if all necessary args are supplied' do
|
23
23
|
result = connection.servers.add :name => 'foo', :domain => 'foo.bar.com'
|
24
|
-
result.
|
24
|
+
expect(result).to be_kind_of(Hash)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -29,12 +29,12 @@ describe Netscaler::Server do
|
|
29
29
|
it ':server is required' do
|
30
30
|
expect {
|
31
31
|
connection.servers.remove({'ipaddress'=>'123.123.123.123'})
|
32
|
-
}.
|
32
|
+
}.to raise_error(ArgumentError, /server/)
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'returns a Hash object if all necessary args are supplied' do
|
36
36
|
result = connection.servers.remove :server => 'foo'
|
37
|
-
result.
|
37
|
+
expect(result).to be_kind_of(Hash)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -44,12 +44,12 @@ describe Netscaler::Server do
|
|
44
44
|
it ':server is required' do
|
45
45
|
expect {
|
46
46
|
connection.servers.send(toggle_action, nil)
|
47
|
-
}.
|
47
|
+
}.to raise_error(ArgumentError, /null/)
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'returns a hash if all necesssary args are supplied' do
|
51
51
|
result = connection.servers.send(toggle_action, :server => 'foo')
|
52
|
-
result.
|
52
|
+
expect(result).to be_kind_of(Hash)
|
53
53
|
end
|
54
54
|
|
55
55
|
end
|
@@ -59,12 +59,12 @@ describe Netscaler::Server do
|
|
59
59
|
it ':server is required' do
|
60
60
|
expect {
|
61
61
|
connection.servers.show_bindings({})
|
62
|
-
}.
|
62
|
+
}.to raise_error(ArgumentError, /server/)
|
63
63
|
end
|
64
64
|
|
65
65
|
it 'returns a Hash object if all necessary args are supplied' do
|
66
66
|
result = connection.servers.show_bindings :server => 'foo'
|
67
|
-
result.
|
67
|
+
expect(result).to be_kind_of(Hash)
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -72,17 +72,17 @@ describe Netscaler::Server do
|
|
72
72
|
it ':server is required if arguments are specified' do
|
73
73
|
expect {
|
74
74
|
connection.servers.show_bindings({something: 'notcool'})
|
75
|
-
}.
|
75
|
+
}.to raise_error(ArgumentError, /server/)
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'returns a Hash object if server arg supplied' do
|
79
79
|
result = connection.servers.show_bindings :server => 'foo'
|
80
|
-
result.
|
80
|
+
expect(result).to be_kind_of(Hash)
|
81
81
|
end
|
82
82
|
|
83
83
|
it 'returns a Hash object if no args supplied since it then returns all servers' do
|
84
84
|
result = connection.servers.show_bindings :server => 'foo'
|
85
|
-
result.
|
85
|
+
expect(result).to be_kind_of(Hash)
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
data/spec/service_spec.rb
CHANGED
@@ -10,31 +10,31 @@ describe Netscaler::Server do
|
|
10
10
|
it 'a name is required' do
|
11
11
|
expect {
|
12
12
|
connection.service.add(:serverName => 'foo', :serviceType => 'HTTP', :port => '80')
|
13
|
-
}.
|
13
|
+
}.to raise_error(ArgumentError, /name/)
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'a serverName is required' do
|
17
17
|
expect {
|
18
18
|
connection.service.add(:name => 'foo_80', :serviceType => 'HTTP', :port => '80')
|
19
|
-
}.
|
19
|
+
}.to raise_error(ArgumentError, /serverName/)
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'a serviceType is required' do
|
23
23
|
expect {
|
24
24
|
connection.service.add(:name => 'foo_80', :serverName => 'foo', :port => '80')
|
25
|
-
}.
|
25
|
+
}.to raise_error(ArgumentError, /serviceType/)
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'a port is required' do
|
29
29
|
expect {
|
30
30
|
connection.service.add(:name => 'foo_80', :serverName => 'foo', :serviceType => 'HTTP')
|
31
|
-
}.
|
31
|
+
}.to raise_error(ArgumentError, /port/)
|
32
32
|
end
|
33
33
|
|
34
34
|
|
35
35
|
it 'returns a Hash object if all necessary args are supplied' do
|
36
36
|
result = connection.service.add(:name => 'foo_80', :serverName => 'foo', :serviceType => 'HTTP', :port => '80')
|
37
|
-
result.
|
37
|
+
expect(result).to be_kind_of(Hash)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
data/spec/servicegroup_spec.rb
CHANGED
@@ -12,13 +12,13 @@ describe Netscaler::ServiceGroup do
|
|
12
12
|
it 'a name is required' do
|
13
13
|
expect {
|
14
14
|
connection.servicegroups.add({ 'serviceType' => 'tcp' })
|
15
|
-
}.
|
15
|
+
}.to raise_error(ArgumentError, /serviceGroupName/)
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'a service type is required' do
|
19
19
|
expect {
|
20
20
|
connection.servicegroups.add({ 'serviceGroupName' => 'test-serviceGroup' })
|
21
|
-
}.
|
21
|
+
}.to raise_error(ArgumentError, /serviceType/)
|
22
22
|
end
|
23
23
|
|
24
24
|
end
|
@@ -28,15 +28,15 @@ describe Netscaler::ServiceGroup do
|
|
28
28
|
it 'has to require a serviceGroupName' do
|
29
29
|
expect {
|
30
30
|
connection.servicegroups.remove()
|
31
|
-
}.
|
31
|
+
}.to raise_error(ArgumentError, /wrong number of arguments/)
|
32
32
|
expect {
|
33
33
|
connection.servicegroups.remove(:foo => 'bar')
|
34
|
-
}.
|
34
|
+
}.to raise_error(ArgumentError, /serviceGroupName/)
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'returns a Hash object if all necessary args are supplied' do
|
38
38
|
result = connection.servicegroups.show_bindings :serviceGroupName => 'foo'
|
39
|
-
result.
|
39
|
+
expect(result).to be_kind_of(Hash)
|
40
40
|
end
|
41
41
|
|
42
42
|
end
|
@@ -47,19 +47,19 @@ describe Netscaler::ServiceGroup do
|
|
47
47
|
it 'a Service group name is required' do
|
48
48
|
expect {
|
49
49
|
connection.servicegroups.bind({ 'port'=> '8080', 'ip' => '199.199.199.199' })
|
50
|
-
}.
|
50
|
+
}.to raise_error(ArgumentError, /serviceGroupName/)
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'a server entity is required' do
|
54
54
|
expect {
|
55
55
|
connection.servicegroups.bind({ 'serviceGroupName' => 'test-serviceGroup', 'port' => '8080' })
|
56
|
-
}.
|
56
|
+
}.to raise_error(ArgumentError, /serverName/)
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'a port is required' do
|
60
60
|
expect {
|
61
61
|
connection.servicegroups.bind({ 'serviceGroupName' => 'test-serviceGroup', 'ip' => '199.199.199.199' })
|
62
|
-
}.
|
62
|
+
}.to raise_error(ArgumentError, /port/)
|
63
63
|
end
|
64
64
|
|
65
65
|
end
|
@@ -69,19 +69,19 @@ describe Netscaler::ServiceGroup do
|
|
69
69
|
it 'a Service group name is required' do
|
70
70
|
expect {
|
71
71
|
connection.servicegroups.unbind({ 'port' => '8080', 'ip' => '199.199.199.199' })
|
72
|
-
}.
|
72
|
+
}.to raise_error(ArgumentError, /serviceGroupName/)
|
73
73
|
end
|
74
74
|
|
75
75
|
it 'a server entity is required' do
|
76
76
|
expect {
|
77
77
|
connection.servicegroups.unbind({ 'serviceGroupName' => 'test-serviceGroup', 'port' => '8080' })
|
78
|
-
}.
|
78
|
+
}.to raise_error(ArgumentError, /serverName/)
|
79
79
|
end
|
80
80
|
|
81
81
|
it 'a port is required' do
|
82
82
|
expect {
|
83
83
|
connection.servicegroups.unbind({ 'serviceGroupName' => 'test-serviceGroup', 'ip' => '199.199.199.199' })
|
84
|
-
}.
|
84
|
+
}.to raise_error(ArgumentError, /port/)
|
85
85
|
end
|
86
86
|
|
87
87
|
end
|
@@ -92,12 +92,12 @@ describe Netscaler::ServiceGroup do
|
|
92
92
|
it ':serviceGroupName is required' do
|
93
93
|
expect {
|
94
94
|
connection.servicegroups.send(toggle_action, {})
|
95
|
-
}.
|
95
|
+
}.to raise_error(ArgumentError, /serviceGroupName/)
|
96
96
|
end
|
97
97
|
|
98
98
|
it 'returns a hash if all necesssary args are supplied' do
|
99
99
|
result = connection.servicegroups.send(toggle_action, :serviceGroupName => 'foo')
|
100
|
-
result.
|
100
|
+
expect(result).to be_kind_of(Hash)
|
101
101
|
end
|
102
102
|
|
103
103
|
end
|
@@ -107,24 +107,24 @@ describe Netscaler::ServiceGroup do
|
|
107
107
|
it ':serviceGroupName is required' do
|
108
108
|
expect {
|
109
109
|
connection.servicegroups.send("#{toggle_action}_server", {:serverName => 'foo', :port => '80'})
|
110
|
-
}.
|
110
|
+
}.to raise_error(ArgumentError, /serviceGroupName/)
|
111
111
|
end
|
112
112
|
|
113
113
|
it ':serviceGroupName is required' do
|
114
114
|
expect {
|
115
115
|
connection.servicegroups.send("#{toggle_action}_server", {:serviceGroupName => 'foo', :port => '80'})
|
116
|
-
}.
|
116
|
+
}.to raise_error(ArgumentError, /serverName/)
|
117
117
|
end
|
118
118
|
|
119
119
|
it ':serviceGroupName is required' do
|
120
120
|
expect {
|
121
121
|
connection.servicegroups.send("#{toggle_action}_server", {:serviceGroupName => 'bar', :serverName => 'foo'})
|
122
|
-
}.
|
122
|
+
}.to raise_error(ArgumentError, /port/)
|
123
123
|
end
|
124
124
|
|
125
125
|
it 'should return a Hash if all args are returned' do
|
126
126
|
result = connection.servicegroups.send("#{toggle_action}_server", {:serviceGroupName => 'bar', :serverName => 'foo', :port => '80'})
|
127
|
-
result.
|
127
|
+
expect(result).to be_kind_of(Hash)
|
128
128
|
end
|
129
129
|
|
130
130
|
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
require 'netscaler'
|
3
|
+
require 'netscaler/mock_adapter'
|
4
|
+
|
5
|
+
describe Netscaler::Cs::Vserver do
|
6
|
+
|
7
|
+
connection = Netscaler::Connection.new 'hostname' => 'foo', 'password' => 'bar', 'username' => 'bar'
|
8
|
+
connection.adapter = Netscaler::MockAdapter.new :body => '{ "errorcode": 0, "message": "Done" }'
|
9
|
+
|
10
|
+
context 'when adding a new ssl vserver' do
|
11
|
+
it 'a name is required' do
|
12
|
+
expect {
|
13
|
+
connection.ssl.vserver.add(:serviceType => 'SSL', :port => '443', :ipv46 => '1.1.1.1')
|
14
|
+
}.to raise_error(ArgumentError, /name/)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'a service type is required' do
|
18
|
+
expect {
|
19
|
+
connection.ssl.vserver.add(:name => 'foo', :port => '443', :ipv46 => '1.1.1.1')
|
20
|
+
}.to raise_error(ArgumentError, /serviceType/)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'a port is required' do
|
24
|
+
expect {
|
25
|
+
connection.ssl.vserver.add(:name => 'foo', :serviceType => 'SSL', :ipv46 => '1.1.1.1')
|
26
|
+
}.to raise_error(ArgumentError, /port/)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'a ipv46 is required' do
|
30
|
+
expect {
|
31
|
+
connection.ssl.vserver.add(:name => 'foo', :serviceType => 'SSL', :port => '443')
|
32
|
+
}.to raise_error(ArgumentError, /ipv46/)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'return hash when supplied all required params' do
|
36
|
+
result = connection.ssl.vserver.add(:name => 'foo', :serviceType => 'SSL', :port => '443', :ipv46 => '1.1.1.1')
|
37
|
+
expect(result).to be_kind_of(Hash)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'when using the show method in Ssl::Vserver' do
|
42
|
+
it 'with no param used it will return all vservers' do
|
43
|
+
result = connection.ssl.vserver.show
|
44
|
+
expect(result).to be_kind_of(Hash)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'supplying the name parameter will return Hash' do
|
48
|
+
result = connection.ssl.vserver.show :name => 'foo'
|
49
|
+
expect(result).to be_kind_of(Hash)
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'when showing a particular lb vserver string is invalid' do
|
53
|
+
expect {
|
54
|
+
connection.ssl.vserver.show('asdf')
|
55
|
+
}.to raise_error(TypeError, /conver(t|sion)/)
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'when showing a particular ssl vserver :name is required' do
|
59
|
+
expect {
|
60
|
+
connection.ssl.vserver.show(:foo => 'bar')
|
61
|
+
}.to raise_error(ArgumentError, /name/)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'when removing an ssl vserver' do
|
66
|
+
it 'a name is required' do
|
67
|
+
expect {
|
68
|
+
connection.ssl.vserver.remove()
|
69
|
+
}.to raise_error(ArgumentError, /wrong number/)
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'throw an arg error if :name arg is missing' do
|
73
|
+
expect {
|
74
|
+
connection.ssl.vserver.remove(:foo => 'bar')
|
75
|
+
}.to raise_error(ArgumentError, /name/)
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'should return a hash if :name is supplied' do
|
79
|
+
result = connection.ssl.vserver.remove :name => 'foo'
|
80
|
+
expect(result).to be_kind_of(Hash)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
context 'when showing ssl vserver bindings' do
|
85
|
+
it 'should throw an error if there is no arg' do
|
86
|
+
expect {
|
87
|
+
connection.ssl.vserver.show_binding()
|
88
|
+
}.to raise_error(ArgumentError, /wrong number/)
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'throw an arg error if :name arg is missing' do
|
92
|
+
expect {
|
93
|
+
connection.ssl.vserver.show_binding(:foo => 'bar')
|
94
|
+
}.to raise_error(ArgumentError, /name/)
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'should return a hash if :name is supplied' do
|
98
|
+
result = connection.ssl.vserver.show_binding :name => 'foo'
|
99
|
+
expect(result).to be_kind_of(Hash)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
context 'when [un]binding certificate to ssl vserver' do
|
104
|
+
it 'should throw an error if :sslcertkey arg is not given' do
|
105
|
+
expect {
|
106
|
+
connection.ssl.vserver.bind.sslcertkey :name => 'foo'
|
107
|
+
}.to raise_error(ArgumentError, /name/)
|
108
|
+
expect {
|
109
|
+
connection.ssl.vserver.unbind.sslcertkey :name => 'foo'
|
110
|
+
}.to raise_error(ArgumentError, /name/)
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'should throw an error if :name arg is not given' do
|
114
|
+
expect {
|
115
|
+
connection.ssl.vserver.bind.sslcertkey :sslcertkey => 'foo'
|
116
|
+
}.to raise_error(ArgumentError, /name/)
|
117
|
+
expect {
|
118
|
+
connection.ssl.vserver.unbind.sslcertkey :sslcertkey => 'foo'
|
119
|
+
}.to raise_error(ArgumentError, /name/)
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'should return a Hash if all require arguments are supplied' do
|
123
|
+
result = connection.ssl.vserver.bind.sslcertkey :certkeyname => 'foo', :name => 'bar'
|
124
|
+
expect(result).to be_kind_of(Hash)
|
125
|
+
unbind_result = connection.ssl.vserver.unbind.sslcertkey :certkeyname => 'foo', :name => 'bar'
|
126
|
+
expect(unbind_result).to be_kind_of(Hash)
|
127
|
+
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|