solaris-patch 1.0.2 → 1.0.3
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 +7 -0
- data/README.rdoc +12 -13
- data/Rakefile +7 -7
- data/lib/solaris.rb +0 -2
- data/lib/solaris/exception.rb +0 -2
- data/lib/solaris/patch.rb +15 -17
- data/lib/solaris/patchdiag.rb +50 -32
- data/lib/solaris/patchdiag_entry.rb +24 -20
- data/lib/solaris/util.rb +6 -8
- data/test/test_patch.rb +39 -41
- data/test/test_patchdiag.rb +145 -105
- data/test/test_patchdiag_entry.rb +88 -68
- data/test/test_solaris.rb +1 -3
- data/test/test_util.rb +3 -5
- metadata +22 -21
data/lib/solaris/util.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
module Solaris
|
3
2
|
|
4
3
|
# Utility module.
|
@@ -34,28 +33,28 @@ module Solaris
|
|
34
33
|
end
|
35
34
|
# If we got a filename then open now before attempting download
|
36
35
|
raise ArgumentError, 'Cannot specify both :to_dir and :to_file' if filename && dirname
|
37
|
-
filename = File.join(
|
36
|
+
filename = File.join(dirname, File.basename(url)) if dirname
|
38
37
|
begin
|
39
|
-
file = File.open(
|
38
|
+
file = File.open(filename, 'w') if filename
|
40
39
|
# Set agent authentication parameters
|
41
40
|
if opts[:user] && opts[:password]
|
42
|
-
agent.basic_auth(
|
41
|
+
agent.basic_auth(opts[:user], opts[:password])
|
43
42
|
elsif opts[:user]
|
44
43
|
raise ArgumentError, 'Cannot authenticate without a password'
|
45
44
|
elsif opts[:password]
|
46
45
|
raise ArgumentError, 'Cannot authenticate without a username'
|
47
46
|
end
|
48
47
|
# Download file and save as required
|
49
|
-
page = agent.get(
|
48
|
+
page = agent.get(url)
|
50
49
|
if file
|
51
|
-
file.write(
|
50
|
+
file.write(page.body)
|
52
51
|
file.close
|
53
52
|
end
|
54
53
|
rescue => exception
|
55
54
|
# Try to remove incomplete file on error
|
56
55
|
if file
|
57
56
|
begin file.close ; rescue ; end
|
58
|
-
begin File.unlink(
|
57
|
+
begin File.unlink(file) ; rescue ; end
|
59
58
|
end
|
60
59
|
raise exception # rethrow original exception
|
61
60
|
end
|
@@ -65,4 +64,3 @@ module Solaris
|
|
65
64
|
end # Util
|
66
65
|
|
67
66
|
end # Solaris
|
68
|
-
|
data/test/test_patch.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
require 'test/unit'
|
3
2
|
require 'solaris/patch'
|
4
3
|
|
@@ -6,83 +5,83 @@ require 'solaris/patch'
|
|
6
5
|
class TestPatch < Test::Unit::TestCase #:nodoc:
|
7
6
|
|
8
7
|
def test_new_string_major_only
|
9
|
-
patch = Solaris::Patch.new(
|
10
|
-
assert_equal(
|
11
|
-
assert_nil(
|
8
|
+
patch = Solaris::Patch.new('123456')
|
9
|
+
assert_equal(123456, patch.major)
|
10
|
+
assert_nil(patch.minor)
|
12
11
|
end
|
13
12
|
|
14
13
|
def test_new_int_major_only
|
15
|
-
patch = Solaris::Patch.new(
|
16
|
-
assert_equal(
|
17
|
-
assert_nil(
|
14
|
+
patch = Solaris::Patch.new(123456)
|
15
|
+
assert_equal(123456, patch.major)
|
16
|
+
assert_nil(patch.minor)
|
18
17
|
end
|
19
18
|
|
20
19
|
def test_new_string_minor_only
|
21
|
-
assert_raise(
|
22
|
-
Solaris::Patch.new(
|
20
|
+
assert_raise(ArgumentError) do
|
21
|
+
Solaris::Patch.new('-78')
|
23
22
|
end
|
24
23
|
end
|
25
24
|
|
26
25
|
def test_new_string_major_and_minor
|
27
|
-
patch = Solaris::Patch.new(
|
28
|
-
assert_equal(
|
29
|
-
assert_equal(
|
26
|
+
patch = Solaris::Patch.new('123456-78')
|
27
|
+
assert_equal(123456, patch.major)
|
28
|
+
assert_equal(78, patch.minor)
|
30
29
|
end
|
31
30
|
|
32
31
|
def test_new_int_major_and_minor
|
33
|
-
patch = Solaris::Patch.new(
|
34
|
-
assert_equal(
|
35
|
-
assert_equal(
|
32
|
+
patch = Solaris::Patch.new(123456, 78)
|
33
|
+
assert_equal(123456, patch.major)
|
34
|
+
assert_equal(78, patch.minor)
|
36
35
|
end
|
37
36
|
|
38
37
|
def test_new_no_args
|
39
38
|
patch = Solaris::Patch.new()
|
40
|
-
assert_nil(
|
41
|
-
assert_nil(
|
39
|
+
assert_nil(patch.major)
|
40
|
+
assert_nil(patch.minor)
|
42
41
|
end
|
43
42
|
|
44
43
|
def test_new_valid_opts
|
45
|
-
patch = Solaris::Patch.new(
|
46
|
-
assert_equal(
|
47
|
-
assert_equal(
|
44
|
+
patch = Solaris::Patch.new('123456-78')
|
45
|
+
assert_equal(123456, patch.major)
|
46
|
+
assert_equal(78, patch.minor)
|
48
47
|
end
|
49
48
|
|
50
49
|
def test_to_s
|
51
|
-
patch = Solaris::Patch.new(
|
52
|
-
assert_equal(
|
50
|
+
patch = Solaris::Patch.new('123456-78')
|
51
|
+
assert_equal('123456-78', patch.to_s)
|
53
52
|
end
|
54
53
|
|
55
54
|
def test_to_s_padding
|
56
|
-
patch = Solaris::Patch.new(
|
57
|
-
assert_equal(
|
55
|
+
patch = Solaris::Patch.new('123456-7')
|
56
|
+
assert_equal('123456-07', patch.to_s)
|
58
57
|
end
|
59
58
|
|
60
59
|
def test_to_s_major_only
|
61
|
-
patch = Solaris::Patch.new(
|
62
|
-
assert_equal(
|
60
|
+
patch = Solaris::Patch.new(123456)
|
61
|
+
assert_equal('123456', patch.to_s)
|
63
62
|
end
|
64
63
|
|
65
64
|
def test_comparison
|
66
|
-
assert(
|
67
|
-
assert(
|
68
|
-
assert(
|
69
|
-
assert(
|
70
|
-
assert(
|
71
|
-
assert(
|
65
|
+
assert(Solaris::Patch.new('123456-78') == Solaris::Patch.new('123456-78'))
|
66
|
+
assert(Solaris::Patch.new('123456-1') == Solaris::Patch.new('123456-01'))
|
67
|
+
assert(Solaris::Patch.new('123456') == Solaris::Patch.new('123456'))
|
68
|
+
assert(Solaris::Patch.new('123456-78') < Solaris::Patch.new('123456-79'))
|
69
|
+
assert(Solaris::Patch.new('123456-78') < Solaris::Patch.new('123457-78'))
|
70
|
+
assert(Solaris::Patch.new('123456-1') < Solaris::Patch.new('123456-10'))
|
72
71
|
end
|
73
72
|
|
74
73
|
def test_download_requires_major
|
75
74
|
patch = Solaris::Patch.new
|
76
75
|
patch.minor = 1
|
77
|
-
assert_raise(
|
78
|
-
assert_raise(
|
76
|
+
assert_raise(ArgumentError) { patch.download_patch! }
|
77
|
+
assert_raise(ArgumentError) { patch.download_readme! }
|
79
78
|
end
|
80
79
|
|
81
80
|
def test_download_requires_minor
|
82
81
|
patch = Solaris::Patch.new
|
83
82
|
patch.major = 123456
|
84
|
-
assert_raise(
|
85
|
-
assert_raise(
|
83
|
+
assert_raise(ArgumentError) { patch.download_patch! }
|
84
|
+
assert_raise(ArgumentError) { patch.download_readme! }
|
86
85
|
end
|
87
86
|
|
88
87
|
def test_download!
|
@@ -90,11 +89,10 @@ class TestPatch < Test::Unit::TestCase #:nodoc:
|
|
90
89
|
end
|
91
90
|
|
92
91
|
def test_pad_minor
|
93
|
-
assert_equal(
|
94
|
-
assert_equal(
|
95
|
-
assert_equal(
|
96
|
-
assert_equal(
|
92
|
+
assert_equal('00', Solaris::Patch.pad_minor(0))
|
93
|
+
assert_equal('01', Solaris::Patch.pad_minor(1))
|
94
|
+
assert_equal('12', Solaris::Patch.pad_minor(12))
|
95
|
+
assert_equal('123', Solaris::Patch.pad_minor(123))
|
97
96
|
end
|
98
97
|
|
99
98
|
end
|
100
|
-
|
data/test/test_patchdiag.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
require 'test/unit'
|
3
2
|
require 'stringio'
|
4
3
|
require 'solaris/patchdiag'
|
@@ -77,9 +76,9 @@ class TestPatchdiag < Test::Unit::TestCase #:nodoc:
|
|
77
76
|
654322|01|Jan/01/00| | |O| |Unbundled|||Obsoleted by: 654321-05
|
78
77
|
115302|01|Jul/08/03| | |O| B|Unbundled|||WITHDRAWN PATCH Obsoleted by: 115302-02 Hardware/PROM: CP2060/CP20
|
79
78
|
EOF
|
80
|
-
@patchdiag_fileish = StringIO.new(
|
79
|
+
@patchdiag_fileish = StringIO.new(@patchdiag_string)
|
81
80
|
@patchdiag_size = 56
|
82
|
-
@patchdiag = Solaris::Patchdiag.open(
|
81
|
+
@patchdiag = Solaris::Patchdiag.open(@patchdiag_fileish)
|
83
82
|
end
|
84
83
|
|
85
84
|
def teardown
|
@@ -91,202 +90,243 @@ EOF
|
|
91
90
|
end
|
92
91
|
|
93
92
|
def test_new_by_fileish
|
94
|
-
assert_equal(
|
93
|
+
assert_equal(@patchdiag_size, @patchdiag.entries.size)
|
95
94
|
end
|
96
95
|
|
97
96
|
def test_new_by_filename
|
98
|
-
temp = Tempfile.new(
|
97
|
+
temp = Tempfile.new('test_patchdiag')
|
99
98
|
path = temp.path
|
100
|
-
temp.write(
|
99
|
+
temp.write(@patchdiag_fileish)
|
101
100
|
temp.close
|
102
|
-
patchdiag = Solaris::Patchdiag.new(
|
103
|
-
File.unlink(
|
104
|
-
assert_equal(
|
101
|
+
patchdiag = Solaris::Patchdiag.new(path)
|
102
|
+
File.unlink(path)
|
103
|
+
assert_equal(@patchdiag_size, @patchdiag.entries.size)
|
105
104
|
end
|
106
105
|
|
107
106
|
def test_new_empty_file
|
108
|
-
if File.exists?(
|
109
|
-
patchdiag = Solaris::Patchdiag.new(
|
110
|
-
assert_equal(
|
107
|
+
if File.exists?(@empty_file)
|
108
|
+
patchdiag = Solaris::Patchdiag.new(@empty_file)
|
109
|
+
assert_equal(0, patchdiag.entries.size)
|
111
110
|
end
|
112
111
|
end
|
113
112
|
|
114
113
|
def test_no_tailing_newline
|
115
114
|
s = StringIO.new('115302|01|Jul/08/03| | |O| B|Unbundled|||blah blah')
|
116
|
-
assert_equal(
|
115
|
+
assert_equal(1, Solaris::Patchdiag.new(s).entries.size)
|
117
116
|
end
|
118
117
|
|
119
118
|
def test_clone
|
120
119
|
@cloned = @patchdiag.clone
|
121
|
-
assert_equal(
|
122
|
-
assert_equal(
|
123
|
-
assert_equal(
|
124
|
-
assert_not_equal(
|
125
|
-
@patchdiag.entries.zip(
|
126
|
-
assert_not_equal(
|
120
|
+
assert_equal(@patchdiag.class, @cloned.class)
|
121
|
+
assert_equal(@patchdiag.entries.size, @cloned.entries.size)
|
122
|
+
assert_equal(@patchdiag.entries.first, @cloned.entries.first)
|
123
|
+
assert_not_equal(@patchdiag.object_id, @cloned.object_id)
|
124
|
+
@patchdiag.entries.zip(@cloned.entries).each do |x,y|
|
125
|
+
assert_not_equal(x.object_id, y.object_id)
|
127
126
|
end
|
128
127
|
end
|
129
128
|
|
130
129
|
def test_entries
|
131
|
-
assert_equal(
|
130
|
+
assert_equal(@patchdiag_size, @patchdiag.entries.size)
|
132
131
|
end
|
133
132
|
|
134
133
|
def test_sort_by_date_order_ascending
|
135
|
-
all = @patchdiag.sort_by(
|
134
|
+
all = @patchdiag.sort_by(&:date)
|
136
135
|
first = all.first.patch # oldest
|
137
136
|
last = all.last.patch # newest
|
138
|
-
assert_equal(
|
139
|
-
assert_equal(
|
137
|
+
assert_equal(Solaris::Patch.new('100386-01'), first)
|
138
|
+
assert_equal(Solaris::Patch.new('146443-01'), last)
|
140
139
|
end
|
141
140
|
|
142
141
|
def test_sort_by_patch_order_ascending
|
143
142
|
all = @patchdiag.sort
|
144
143
|
first = all.first.patch # smallest
|
145
144
|
last = all.last.patch # largest
|
146
|
-
assert_equal(
|
147
|
-
assert_equal(
|
145
|
+
assert_equal(Solaris::Patch.new('800054-01'), last)
|
146
|
+
assert_equal(Solaris::Patch.new('100287-05'), first)
|
148
147
|
end
|
149
148
|
|
150
149
|
def test_open_block
|
151
|
-
ret = Solaris::Patchdiag.open(
|
152
|
-
assert_equal(
|
150
|
+
ret = Solaris::Patchdiag.open(@patchdiag_fileish) do |patchdiag|
|
151
|
+
assert_equal(Solaris::Patchdiag, patchdiag.class)
|
153
152
|
:return_code
|
154
153
|
end
|
155
|
-
assert_equal(
|
154
|
+
assert_equal(:return_code, ret)
|
156
155
|
end
|
157
156
|
|
158
157
|
def test_open_return
|
159
|
-
assert_equal(
|
158
|
+
assert_equal(Solaris::Patchdiag, @patchdiag.class)
|
160
159
|
end
|
161
160
|
|
162
161
|
def test_bad
|
163
|
-
entry = @patchdiag.latest(
|
164
|
-
assert_equal(
|
165
|
-
entry = @patchdiag.latest(
|
166
|
-
assert_equal(
|
162
|
+
entry = @patchdiag.latest('115302')
|
163
|
+
assert_equal(true, entry.bad?)
|
164
|
+
entry = @patchdiag.latest('654321-01')
|
165
|
+
assert_equal(false, entry.bad?)
|
167
166
|
end
|
168
167
|
|
169
168
|
def test_recommended
|
170
|
-
entry = @patchdiag.latest(
|
171
|
-
assert_equal(
|
172
|
-
entry = @patchdiag.latest(
|
173
|
-
assert_equal(
|
169
|
+
entry = @patchdiag.latest('146279-01')
|
170
|
+
assert_equal(true, entry.recommended?)
|
171
|
+
entry = @patchdiag.latest('654321-01')
|
172
|
+
assert_equal(false, entry.recommended?)
|
174
173
|
end
|
175
174
|
|
176
175
|
def test_security
|
177
|
-
entry = @patchdiag.latest(
|
178
|
-
assert_equal(
|
179
|
-
entry = @patchdiag.latest(
|
180
|
-
assert_equal(
|
176
|
+
entry = @patchdiag.latest('146279-01')
|
177
|
+
assert_equal(true, entry.security?)
|
178
|
+
entry = @patchdiag.latest('654321-01')
|
179
|
+
assert_equal(false, entry.security?)
|
181
180
|
end
|
182
181
|
|
183
182
|
def test_obsolete
|
184
|
-
entry = @patchdiag.latest(
|
185
|
-
assert_equal(
|
186
|
-
entry = @patchdiag.latest(
|
187
|
-
assert_equal(
|
183
|
+
entry = @patchdiag.latest('115302-01')
|
184
|
+
assert_equal(true, entry.obsolete?)
|
185
|
+
entry = @patchdiag.latest('100287-05')
|
186
|
+
assert_equal(false, entry.obsolete?)
|
187
|
+
end
|
188
|
+
|
189
|
+
def test_date
|
190
|
+
assert_equal(2011, @patchdiag.date.year)
|
191
|
+
assert_equal(2, @patchdiag.date.month)
|
192
|
+
assert_equal(10, @patchdiag.date.day)
|
193
|
+
end
|
194
|
+
|
195
|
+
# Some old patchdiag.xref (eg Sep/24/08) contain extraneous HTML <PRE> tags.
|
196
|
+
def test_pre
|
197
|
+
pd_s = <<-EOF
|
198
|
+
<PRE>
|
199
|
+
## PATCHDIAG TOOL CROSS-REFERENCE FILE AS OF Sep/24/08 ##
|
200
|
+
##
|
201
|
+
## Please note that certain patches which are listed in
|
202
|
+
## Sun's Quick Reference Section or other patch reference
|
203
|
+
## files are not publicly available, but instead are
|
204
|
+
## available only to customers of Sun Microsystems who
|
205
|
+
## have purchased an appropriate support services contract.
|
206
|
+
## For more information about Sun support services contracts
|
207
|
+
## visit www.sun.com/service
|
208
|
+
100287|05|Oct/31/91| | | | |Unbundled|||PC-NFS 3.5c: Jumbo patch (updated PRT.COM to v3.5c)
|
209
|
+
100323|05|Feb/11/92| | | | |Unbundled|||PC-NFS Advanced Telnet: bug fixes, National Character Set support
|
210
|
+
100386|01|Sep/20/91| | | | |Unbundled|||PC-NFS Programmer's Toolkit/2.0: Runtime modules
|
211
|
+
139099|01|Sep/05/08|R|S| | |10|sparc;|SUNWgtar:11.10.0,REV=2005.01.08.05.16;SUNWgtarS:11.10.0,REV=2005.01.08.05.16;SUNWsfman:11.10.0,REV=2005.01.08.05.16;|SunOS 5.10: gtar patch
|
212
|
+
139100|01|Sep/05/08|R|S| | |10_x86|i386;|SUNWgtar:11.10.0,REV=2005.01.08.01.09;SUNWgtarS:11.10.0,REV=2005.01.08.01.09;SUNWsfman:11.10.0,REV=2005.01.08.01.09;|SunOS 5.10_x86: gtar patch
|
213
|
+
800054|01|Mar/16/01| | |O| |Unbundled|||Obsoleted by: 111346-01 Hardware/PROM: Sun Fire 3800/4800/4810/680
|
214
|
+
</PRE>
|
215
|
+
EOF
|
216
|
+
pd = Solaris::Patchdiag.new(StringIO.new(pd_s))
|
217
|
+
assert_equal(2008, pd.date.year)
|
218
|
+
assert_equal(9, pd.date.month)
|
219
|
+
assert_equal(24, pd.date.day)
|
220
|
+
assert_equal(pd_s, pd.to_s)
|
188
221
|
end
|
189
222
|
|
190
223
|
def test_find
|
191
|
-
assert_equal(
|
192
|
-
assert_equal(
|
193
|
-
assert_equal(
|
194
|
-
assert_equal(
|
195
|
-
assert_equal(
|
196
|
-
assert_equal(
|
197
|
-
assert_equal(
|
198
|
-
assert_equal(
|
199
|
-
assert_equal(
|
200
|
-
assert_equal(
|
201
|
-
assert_equal(
|
202
|
-
assert_equal(
|
203
|
-
assert_equal(
|
204
|
-
assert_equal(
|
224
|
+
assert_equal([], @patchdiag.find(123456))
|
225
|
+
assert_equal([], @patchdiag.find('123456'))
|
226
|
+
assert_equal([], @patchdiag.find('123456-78'))
|
227
|
+
assert_equal([], @patchdiag.find(Solaris::Patch.new(123456)))
|
228
|
+
assert_equal([], @patchdiag.find(Solaris::Patch.new('123456')))
|
229
|
+
assert_equal([], @patchdiag.find(Solaris::Patch.new('123456-78')))
|
230
|
+
assert_equal([], @patchdiag.find('100791-01'))
|
231
|
+
assert_equal([], @patchdiag.find(Solaris::Patch.new('100791-01')))
|
232
|
+
assert_equal('100791-04', @patchdiag.find(100791).first.patch.to_s)
|
233
|
+
assert_equal('100791-04', @patchdiag.find('100791').first.patch.to_s)
|
234
|
+
assert_equal('100791-04', @patchdiag.find('100791-04').first.patch.to_s)
|
235
|
+
assert_equal('100791-04', @patchdiag.find(Solaris::Patch.new(100791)).first.patch.to_s)
|
236
|
+
assert_equal('100791-04', @patchdiag.find(Solaris::Patch.new('100791')).first.patch.to_s)
|
237
|
+
assert_equal('100791-04', @patchdiag.find(Solaris::Patch.new('100791-04')).first.patch.to_s)
|
238
|
+
end
|
239
|
+
|
240
|
+
def test_header
|
241
|
+
assert_equal(11, @patchdiag.header.length)
|
205
242
|
end
|
206
243
|
|
207
244
|
def test_last
|
208
|
-
assert_equal(
|
245
|
+
assert_equal('115302-01', @patchdiag.last.patch.to_s)
|
209
246
|
end
|
210
247
|
|
211
248
|
def test_latest
|
212
|
-
assert_raise(
|
213
|
-
@patchdiag.latest(
|
249
|
+
assert_raise(Solaris::Patch::NotFound) do
|
250
|
+
@patchdiag.latest(123456)
|
214
251
|
end
|
215
|
-
assert_equal(
|
216
|
-
assert_equal(
|
217
|
-
assert_equal(
|
218
|
-
assert_equal(
|
219
|
-
assert_equal(
|
220
|
-
assert_equal(
|
221
|
-
assert_equal(
|
222
|
-
assert_equal(
|
252
|
+
assert_equal('100791-05', @patchdiag.latest(100791).patch.to_s)
|
253
|
+
assert_equal('100791-05', @patchdiag.latest('100791').patch.to_s)
|
254
|
+
assert_equal('100791-05', @patchdiag.latest('100791-01').patch.to_s)
|
255
|
+
assert_equal('100791-05', @patchdiag.latest('100791-05').patch.to_s)
|
256
|
+
assert_equal('100791-05', @patchdiag.latest(Solaris::Patch.new(100791)).patch.to_s)
|
257
|
+
assert_equal('100791-05', @patchdiag.latest(Solaris::Patch.new('100791')).patch.to_s)
|
258
|
+
assert_equal('100791-05', @patchdiag.latest(Solaris::Patch.new('100791-01')).patch.to_s)
|
259
|
+
assert_equal('100791-05', @patchdiag.latest(Solaris::Patch.new('100791-05')).patch.to_s)
|
223
260
|
end
|
224
261
|
|
225
262
|
def test_sort
|
226
|
-
assert_equal(
|
263
|
+
assert_equal('115302-01', @patchdiag.entries.last.patch.to_s)
|
227
264
|
sorted = @patchdiag.sort
|
228
|
-
assert_equal(
|
229
|
-
assert_equal(
|
230
|
-
assert_equal(
|
265
|
+
assert_equal(Solaris::Patchdiag, sorted.class)
|
266
|
+
assert_equal('800054-01', sorted.entries.last.patch.to_s)
|
267
|
+
assert_equal('115302-01', @patchdiag.entries.last.patch.to_s)
|
231
268
|
end
|
232
269
|
|
233
270
|
def test_sort!
|
234
|
-
assert_equal(
|
271
|
+
assert_equal('115302-01', @patchdiag.entries.last.patch.to_s)
|
235
272
|
size = @patchdiag.entries.size
|
236
273
|
ret = @patchdiag.sort!
|
237
|
-
assert_equal(
|
238
|
-
assert_equal(
|
239
|
-
assert_equal(
|
240
|
-
assert_equal(
|
274
|
+
assert_equal(@patchdiag, ret)
|
275
|
+
assert_equal(size, @patchdiag.entries.size)
|
276
|
+
assert_equal(Solaris::Patchdiag, @patchdiag.class)
|
277
|
+
assert_equal('800054-01', @patchdiag.entries.last.patch.to_s)
|
241
278
|
end
|
242
279
|
|
243
280
|
def test_successor
|
244
|
-
assert_raise(
|
245
|
-
@patchdiag.latest(
|
281
|
+
assert_raise(Solaris::Patch::NotFound) do
|
282
|
+
@patchdiag.latest(123456)
|
246
283
|
end
|
247
|
-
assert_equal(
|
248
|
-
assert_equal(
|
249
|
-
assert_equal(
|
250
|
-
assert_equal(
|
251
|
-
assert_equal(
|
252
|
-
assert_raise(
|
253
|
-
@patchdiag.successor(
|
284
|
+
assert_equal('100287-05', @patchdiag.successor(100287).patch.to_s)
|
285
|
+
assert_equal('100287-05', @patchdiag.successor('100287').patch.to_s)
|
286
|
+
assert_equal('100287-05', @patchdiag.successor('100287-05').patch.to_s)
|
287
|
+
assert_equal('100287-05', @patchdiag.successor(Solaris::Patch.new('100287-05')).patch.to_s)
|
288
|
+
assert_equal('100974-02', @patchdiag.successor(100791).patch.to_s)
|
289
|
+
assert_raise(Solaris::Patch::NotFound) do
|
290
|
+
@patchdiag.successor(123456)
|
254
291
|
end
|
255
|
-
assert_raise(
|
256
|
-
@patchdiag.successor(
|
292
|
+
assert_raise(Solaris::Patch::NotFound) do
|
293
|
+
@patchdiag.successor(100393) # successor 100394 not in patchdiag.xref
|
257
294
|
end
|
258
|
-
assert_raise(
|
259
|
-
@patchdiag.successor(
|
295
|
+
assert_raise(Solaris::Patch::NotFound) do
|
296
|
+
@patchdiag.successor('654322-05')
|
260
297
|
end
|
261
|
-
assert_equal(
|
262
|
-
assert_raise(
|
263
|
-
@patchdiag.successor(
|
298
|
+
assert_equal('100807-04', @patchdiag.successor('100807-01').patch.to_s)
|
299
|
+
assert_raise(Solaris::Patch::InvalidSuccessor) do
|
300
|
+
@patchdiag.successor('100807-03') # successor 100807-03 WITHDRAWN
|
264
301
|
end
|
265
|
-
assert_raise(
|
266
|
-
@patchdiag.successor(
|
302
|
+
assert_raise(Solaris::Patch::SuccessorLoop) do
|
303
|
+
@patchdiag.successor(654321)
|
267
304
|
end
|
268
|
-
assert_raise(
|
269
|
-
@patchdiag.successor(
|
305
|
+
assert_raise(Solaris::Patch::SuccessorLoop) do
|
306
|
+
@patchdiag.successor('654321-01')
|
270
307
|
end
|
271
|
-
assert_raise(
|
272
|
-
@patchdiag.successor(
|
308
|
+
assert_raise(Solaris::Patch::NotFound) do
|
309
|
+
@patchdiag.successor(115302)
|
273
310
|
end
|
274
311
|
end
|
275
312
|
|
276
313
|
def test_successors
|
277
|
-
assert_equal(
|
278
|
-
@patchdiag.successors(
|
314
|
+
assert_equal(%w{ 100791 100791-05 100974 100974-02 },
|
315
|
+
@patchdiag.successors(100791).map(&:to_s))
|
279
316
|
end
|
280
317
|
|
281
318
|
def test_download!
|
282
319
|
skip 'Mock required'
|
283
320
|
end
|
284
321
|
|
322
|
+
def test_to_s
|
323
|
+
assert_equal(@patchdiag_string, @patchdiag.to_s)
|
324
|
+
end
|
325
|
+
|
285
326
|
private
|
286
327
|
|
287
328
|
def successor(patch)
|
288
|
-
@patchdiag.successor(
|
329
|
+
@patchdiag.successor(patch).patch.to_s
|
289
330
|
end
|
290
331
|
|
291
332
|
end
|
292
|
-
|