openvas-cli 0.1.1 → 0.2.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.
- data/Gemfile +2 -0
- data/Gemfile.lock +50 -0
- data/VERSION +1 -1
- data/lib/openvas-cli/configuration.rb +25 -0
- data/lib/openvas-cli/conn_addin.rb +27 -0
- data/lib/openvas-cli/immutable_children_validator.rb +15 -0
- data/lib/openvas-cli/vas_administrator.rb +7 -0
- data/lib/openvas-cli/vas_base.rb +20 -30
- data/lib/openvas-cli/vas_config.rb +127 -0
- data/lib/openvas-cli/vas_connection.rb +140 -0
- data/lib/openvas-cli/vas_exceptions.rb +9 -7
- data/lib/openvas-cli/vas_lsc_credential.rb +110 -0
- data/lib/openvas-cli/vas_nvt.rb +64 -64
- data/lib/openvas-cli/vas_nvt_family.rb +39 -30
- data/lib/openvas-cli/vas_override.rb +6 -4
- data/lib/openvas-cli/vas_period.rb +89 -0
- data/lib/openvas-cli/vas_preference.rb +139 -49
- data/lib/openvas-cli/vas_report.rb +110 -103
- data/lib/openvas-cli/vas_result.rb +90 -89
- data/lib/openvas-cli/vas_schedule.rb +163 -55
- data/lib/openvas-cli/vas_target.rb +200 -23
- data/lib/openvas-cli/vas_task.rb +229 -30
- data/lib/openvas-cli/vas_task_progress.rb +29 -0
- data/lib/openvas-cli/xml_addin.rb +34 -0
- data/lib/openvas_cli.rb +19 -0
- data/openvas-cli.gemspec +28 -6
- data/spec/openvas-cli/vas_administrator_spec.rb +6 -0
- data/spec/openvas-cli/vas_config_spec.rb +81 -0
- data/spec/openvas-cli/vas_lsc_credential_spec.rb +72 -0
- data/spec/openvas-cli/vas_nvt_family_spec.rb +7 -5
- data/spec/openvas-cli/vas_nvt_spec.rb +30 -26
- data/spec/openvas-cli/vas_period_spec.rb +7 -0
- data/spec/openvas-cli/vas_preference_spec.rb +23 -21
- data/spec/openvas-cli/vas_report_spec.rb +65 -63
- data/spec/openvas-cli/vas_result_spec.rb +94 -93
- data/spec/openvas-cli/vas_schedule_spec.rb +154 -57
- data/spec/openvas-cli/vas_target_spec.rb +140 -28
- data/spec/openvas-cli/vas_task_spec.rb +92 -11
- data/spec/spec_helper.rb +15 -5
- metadata +72 -24
- data/lib/openvas-cli/openvas-cli.rb +0 -273
- data/spec/openvas-cli/openvas-cli_spec.rb +0 -45
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'xml_addin'
|
3
|
+
|
4
|
+
module OpenvasCli
|
5
|
+
class VasTaskProgress
|
6
|
+
include XmlAddin
|
7
|
+
|
8
|
+
attr_accessor :overall
|
9
|
+
|
10
|
+
def initialize(params={})
|
11
|
+
@overall = 0
|
12
|
+
end
|
13
|
+
|
14
|
+
def ip_stats
|
15
|
+
@ip_stats ||= {}
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.from_xml_node(node)
|
19
|
+
ret = VasTaskProgress.new
|
20
|
+
ret.overall = extract_value_from("progress", node)
|
21
|
+
node.xpath("progress/host_progress").each { |p_node|
|
22
|
+
prg = extract_value_from(".", p_node).to_i
|
23
|
+
hst = extract_value_from("host", p_node)
|
24
|
+
ret.ip_stats[hst] = prg
|
25
|
+
}
|
26
|
+
ret
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module OpenvasCli
|
2
|
+
module XmlAddin
|
3
|
+
def self.included(base)
|
4
|
+
base.send :extend, ClassMethods
|
5
|
+
end
|
6
|
+
|
7
|
+
module ClassMethods
|
8
|
+
# Helper method to extract a value from a Nokogiri::XML::Node object. If the
|
9
|
+
# xpath provided contains an @, then the method assumes that the value resides
|
10
|
+
# in an attribute, otherwise it pulls the text of the last +text+ node.
|
11
|
+
def extract_value_from(x_str, n)
|
12
|
+
ret = ""
|
13
|
+
if x_str =~ /@/
|
14
|
+
ret = n.at_xpath(x_str).value if n.at_xpath(x_str)
|
15
|
+
else
|
16
|
+
tn = n.at_xpath(x_str)
|
17
|
+
if tn
|
18
|
+
if tn.children.count > 0
|
19
|
+
tn.children.each { |tnc|
|
20
|
+
if tnc.text?
|
21
|
+
ret = tnc.text
|
22
|
+
end
|
23
|
+
}
|
24
|
+
else
|
25
|
+
ret = tn.text
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
ret
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/openvas_cli.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'openvas-cli/configuration.rb'))
|
2
|
+
|
3
|
+
module OpenvasCli
|
4
|
+
def self.configuration
|
5
|
+
@configuration ||= OpenvasCli::Configuration.new
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.configure
|
9
|
+
yield configuration if block_given?
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.logger
|
13
|
+
@logger
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.logger=(val)
|
17
|
+
@logger = val
|
18
|
+
end
|
19
|
+
end
|
data/openvas-cli.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{openvas-cli}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Reed Swenson"]
|
12
|
-
s.date = %q{2011-03-
|
12
|
+
s.date = %q{2011-03-25}
|
13
13
|
s.description = %q{A full ruby implementation of the OpenVAS OMP (version 2.0) protocol.}
|
14
14
|
s.email = %q{fleureed@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -28,24 +28,37 @@ Gem::Specification.new do |s|
|
|
28
28
|
"features/openvas-cli.feature",
|
29
29
|
"features/step_definitions/openvas-cli_steps.rb",
|
30
30
|
"features/support/env.rb",
|
31
|
+
"lib/openvas-cli/configuration.rb",
|
32
|
+
"lib/openvas-cli/conn_addin.rb",
|
33
|
+
"lib/openvas-cli/immutable_children_validator.rb",
|
31
34
|
"lib/openvas-cli/oid_validator.rb",
|
32
|
-
"lib/openvas-cli/openvas-cli.rb",
|
33
35
|
"lib/openvas-cli/uuid_validator.rb",
|
36
|
+
"lib/openvas-cli/vas_administrator.rb",
|
34
37
|
"lib/openvas-cli/vas_base.rb",
|
38
|
+
"lib/openvas-cli/vas_config.rb",
|
39
|
+
"lib/openvas-cli/vas_connection.rb",
|
35
40
|
"lib/openvas-cli/vas_exceptions.rb",
|
41
|
+
"lib/openvas-cli/vas_lsc_credential.rb",
|
36
42
|
"lib/openvas-cli/vas_nvt.rb",
|
37
43
|
"lib/openvas-cli/vas_nvt_family.rb",
|
38
44
|
"lib/openvas-cli/vas_override.rb",
|
45
|
+
"lib/openvas-cli/vas_period.rb",
|
39
46
|
"lib/openvas-cli/vas_preference.rb",
|
40
47
|
"lib/openvas-cli/vas_report.rb",
|
41
48
|
"lib/openvas-cli/vas_result.rb",
|
42
49
|
"lib/openvas-cli/vas_schedule.rb",
|
43
50
|
"lib/openvas-cli/vas_target.rb",
|
44
51
|
"lib/openvas-cli/vas_task.rb",
|
52
|
+
"lib/openvas-cli/vas_task_progress.rb",
|
53
|
+
"lib/openvas-cli/xml_addin.rb",
|
54
|
+
"lib/openvas_cli.rb",
|
45
55
|
"openvas-cli.gemspec",
|
46
|
-
"spec/openvas-cli/
|
56
|
+
"spec/openvas-cli/vas_administrator_spec.rb",
|
57
|
+
"spec/openvas-cli/vas_config_spec.rb",
|
58
|
+
"spec/openvas-cli/vas_lsc_credential_spec.rb",
|
47
59
|
"spec/openvas-cli/vas_nvt_family_spec.rb",
|
48
60
|
"spec/openvas-cli/vas_nvt_spec.rb",
|
61
|
+
"spec/openvas-cli/vas_period_spec.rb",
|
49
62
|
"spec/openvas-cli/vas_preference_spec.rb",
|
50
63
|
"spec/openvas-cli/vas_report_spec.rb",
|
51
64
|
"spec/openvas-cli/vas_result_spec.rb",
|
@@ -57,12 +70,15 @@ Gem::Specification.new do |s|
|
|
57
70
|
s.homepage = %q{http://reedswenson.github.com/openvas-cli/}
|
58
71
|
s.licenses = ["MIT"]
|
59
72
|
s.require_paths = ["lib"]
|
60
|
-
s.rubygems_version = %q{1.6.
|
73
|
+
s.rubygems_version = %q{1.6.2}
|
61
74
|
s.summary = %q{A full ruby implementation of the OpenVAS OMP (version 2.0) protocol.}
|
62
75
|
s.test_files = [
|
63
|
-
"spec/openvas-cli/
|
76
|
+
"spec/openvas-cli/vas_administrator_spec.rb",
|
77
|
+
"spec/openvas-cli/vas_config_spec.rb",
|
78
|
+
"spec/openvas-cli/vas_lsc_credential_spec.rb",
|
64
79
|
"spec/openvas-cli/vas_nvt_family_spec.rb",
|
65
80
|
"spec/openvas-cli/vas_nvt_spec.rb",
|
81
|
+
"spec/openvas-cli/vas_period_spec.rb",
|
66
82
|
"spec/openvas-cli/vas_preference_spec.rb",
|
67
83
|
"spec/openvas-cli/vas_report_spec.rb",
|
68
84
|
"spec/openvas-cli/vas_result_spec.rb",
|
@@ -78,7 +94,9 @@ Gem::Specification.new do |s|
|
|
78
94
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
79
95
|
s.add_runtime_dependency(%q<activesupport>, [">= 3.0.5"])
|
80
96
|
s.add_runtime_dependency(%q<activerecord>, [">= 3.0.5"])
|
97
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.0.5"])
|
81
98
|
s.add_runtime_dependency(%q<nokogiri>, [">= 1.4.4"])
|
99
|
+
s.add_runtime_dependency(%q<ipaddress>, [">= 0.7.0"])
|
82
100
|
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
83
101
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
84
102
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
@@ -88,7 +106,9 @@ Gem::Specification.new do |s|
|
|
88
106
|
else
|
89
107
|
s.add_dependency(%q<activesupport>, [">= 3.0.5"])
|
90
108
|
s.add_dependency(%q<activerecord>, [">= 3.0.5"])
|
109
|
+
s.add_dependency(%q<rails>, [">= 3.0.5"])
|
91
110
|
s.add_dependency(%q<nokogiri>, [">= 1.4.4"])
|
111
|
+
s.add_dependency(%q<ipaddress>, [">= 0.7.0"])
|
92
112
|
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
93
113
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
94
114
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
@@ -99,7 +119,9 @@ Gem::Specification.new do |s|
|
|
99
119
|
else
|
100
120
|
s.add_dependency(%q<activesupport>, [">= 3.0.5"])
|
101
121
|
s.add_dependency(%q<activerecord>, [">= 3.0.5"])
|
122
|
+
s.add_dependency(%q<rails>, [">= 3.0.5"])
|
102
123
|
s.add_dependency(%q<nokogiri>, [">= 1.4.4"])
|
124
|
+
s.add_dependency(%q<ipaddress>, [">= 0.7.0"])
|
103
125
|
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
104
126
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
105
127
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
module OpenvasCli
|
4
|
+
describe VasConfig do
|
5
|
+
after(:each) do
|
6
|
+
cfgs = VasConfig.get_all
|
7
|
+
|
8
|
+
cfgs.each { |c|
|
9
|
+
c.destroy! if c.name =~ /Test_.*/i
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should get all configurations' do
|
14
|
+
cfgs = VasConfig.get_all
|
15
|
+
|
16
|
+
cfgs.should_not be nil
|
17
|
+
cfgs.length.should be > 0
|
18
|
+
|
19
|
+
old_name = ""
|
20
|
+
cfgs.each { |c|
|
21
|
+
c.should be_valid
|
22
|
+
c.name.should >= old_name
|
23
|
+
old_name = c.name
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should get all configurations with details' do
|
28
|
+
cfgs = VasConfig.get_all(:show_details => true)
|
29
|
+
cfgs.should_not be nil
|
30
|
+
cfgs.length.should be > 0
|
31
|
+
|
32
|
+
cfgs.each { |c|
|
33
|
+
c.should have_at_least(1).family unless c.name =~ /empty/i
|
34
|
+
c.should have_at_least(1).preference
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'be able to copy a configuration' do
|
39
|
+
cfg = VasConfig.get_all[0]
|
40
|
+
|
41
|
+
new_cfg = VasConfig.copy_config(cfg.id, "Test_#{Time.now.strftime('%Y-%m-%d_%H:%M:%S')}")
|
42
|
+
|
43
|
+
new_cfg.should_not be nil
|
44
|
+
new_cfg.id.should_not be cfg.id
|
45
|
+
|
46
|
+
new_cfg.destroy!
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should save a preference if it has been assigned a new value' do
|
50
|
+
cfg = VasConfig.get_all[0]
|
51
|
+
|
52
|
+
new_cfg = VasConfig.copy_config(cfg.id, "Test_#{Time.now.strftime('%Y-%m-%d_%H:%M:%S')}")
|
53
|
+
|
54
|
+
new_cfg.should_not be nil
|
55
|
+
new_cfg.id.should_not be cfg.id
|
56
|
+
|
57
|
+
pref = new_cfg.preferences.choice
|
58
|
+
pref.should_not be nil
|
59
|
+
|
60
|
+
case pref.val_type
|
61
|
+
when :text
|
62
|
+
pref.value = "NEW VALUE"
|
63
|
+
when :boolean
|
64
|
+
pref.value = pref.value ? false : true
|
65
|
+
when :choice
|
66
|
+
pref.value = pref.val_choices[rand(pref.val_choices.count - 1) + 1]
|
67
|
+
end
|
68
|
+
|
69
|
+
pref.should be_changed
|
70
|
+
|
71
|
+
new_cfg.save!
|
72
|
+
|
73
|
+
new_cfg = VasConfig.get_all(:id => new_cfg.id, :show_details => true)[0]
|
74
|
+
i = new_cfg.preferences.index { |p| p.name == pref.name && p.nvt_id == pref.nvt_id }
|
75
|
+
i.should_not be nil
|
76
|
+
|
77
|
+
n_pref = new_cfg.preferences[i]
|
78
|
+
n_pref.value.should == pref.value
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
module OpenvasCli
|
4
|
+
describe VasLscCredential do
|
5
|
+
after(:each) do
|
6
|
+
all = VasLscCredential.get_all
|
7
|
+
|
8
|
+
all.each { |c|
|
9
|
+
c.destroy! if c.name =~ /Test_.*/i
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
def next_test_name
|
14
|
+
"Test_#{Time.now.strftime('%Y-%m-%d_%H:%M:%S')}"
|
15
|
+
end
|
16
|
+
|
17
|
+
def valid_params
|
18
|
+
{
|
19
|
+
:name => next_test_name,
|
20
|
+
:login => "FOOBAR",
|
21
|
+
:comment => "Yet another test credential",
|
22
|
+
:password => "thisCanTr3@llyBe1"
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should pull all available credentials' do
|
27
|
+
all = VasLscCredential.get_all
|
28
|
+
all.should_not be nil
|
29
|
+
all.each { |c| c.should be_valid }
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should create a new lsc_credential' do
|
33
|
+
cred = VasLscCredential.new(valid_params)
|
34
|
+
cred.save!
|
35
|
+
|
36
|
+
cred.id.should_not be nil
|
37
|
+
cred.id.should_not be_empty
|
38
|
+
|
39
|
+
n_cred = VasLscCredential.get_all(:id => cred.id)[0]
|
40
|
+
n_cred.should_not be nil
|
41
|
+
n_cred.id.should == cred.id
|
42
|
+
n_cred.name.should == cred.name
|
43
|
+
n_cred.login.should == cred.login
|
44
|
+
n_cred.comment.should == cred.comment
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should be able to alter a credential' do
|
48
|
+
cred = VasLscCredential.new(valid_params)
|
49
|
+
cred.save!
|
50
|
+
|
51
|
+
n_cred = VasLscCredential.get_all(:id => cred.id)[0]
|
52
|
+
n_cred.login = "NOT_FOOBAR"
|
53
|
+
n_cred.save!
|
54
|
+
|
55
|
+
n_cred.id.should == cred.id
|
56
|
+
|
57
|
+
n_cred = VasLscCredential.get_all(:id => cred.id)[0]
|
58
|
+
n_cred.login.should == "NOT_FOOBAR"
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'should be able to take an SMB style login name' do
|
62
|
+
cred = VasLscCredential.new(valid_params.merge!({:login=>'FOO\\BAR'}))
|
63
|
+
cred.save!
|
64
|
+
cred.id.should_not be nil
|
65
|
+
cred.id.should_not be_empty
|
66
|
+
|
67
|
+
n_cred = VasLscCredential.get_all(:id => cred.id)[0]
|
68
|
+
n_cred.should_not be nil
|
69
|
+
n_cred.login.should == 'FOO\\BAR'
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -1,9 +1,11 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
module OpenvasCli
|
4
|
+
describe VasNVTFamily do
|
5
|
+
it 'should pull all nvt families' do
|
6
|
+
fams = VasNVTFamily.get_all
|
7
|
+
fams.should_not be nil
|
8
|
+
fams.each{ |f| f.should be_valid }
|
9
|
+
end
|
8
10
|
end
|
9
11
|
end
|
@@ -1,32 +1,36 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
it 'should pull an NVT by OID' do
|
12
|
-
rule = VasNVT.get_all(:oid => '1.3.6.1.4.1.25623.1.0.902230')
|
13
|
-
rule.should_not be nil
|
14
|
-
rule.count.should == 1
|
3
|
+
module OpenvasCli
|
4
|
+
describe VasNVT do
|
5
|
+
it 'should pull NVT`s', :slow => true do
|
6
|
+
rules = VasNVT.get_all
|
7
|
+
rules.should_not be nil
|
8
|
+
rules.count.should > 0
|
9
|
+
rules.each{ |r| r.should be_valid }
|
10
|
+
end
|
15
11
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
it 'should pull an NVT by Family' do
|
20
|
-
fams = VasNVTFamily.get_all
|
12
|
+
it 'should pull an NVT by OID', :slow => true do
|
13
|
+
id = VasNVT.get_all.choice.id
|
21
14
|
|
22
|
-
|
15
|
+
rule = VasNVT.get_all(:id => id)
|
16
|
+
rule.should_not be nil
|
17
|
+
rule.count.should == 1
|
18
|
+
|
19
|
+
rule[0].should be_valid
|
20
|
+
end
|
23
21
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
it 'should pull an NVT by Family' do
|
23
|
+
fams = VasNVTFamily.get_all
|
24
|
+
|
25
|
+
my_fam = fams[rand(fams.count)]
|
26
|
+
|
27
|
+
rules = VasNVT.get_all(:family => my_fam.name)
|
28
|
+
rules.should_not be nil
|
29
|
+
rules.count.should == my_fam.nvt_count
|
30
|
+
rules.each { |r|
|
31
|
+
r.should be_valid
|
32
|
+
r.family.should == my_fam.name
|
33
|
+
}
|
34
|
+
end
|
35
|
+
end
|
32
36
|
end
|
@@ -1,26 +1,28 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
preferences
|
6
|
-
|
3
|
+
module OpenvasCli
|
4
|
+
describe VasPreference do
|
5
|
+
it 'should pull all preferences' do
|
6
|
+
preferences = VasPreference.get_all
|
7
|
+
preferences.should_not be nil
|
8
|
+
|
9
|
+
preferences.each { |p|
|
10
|
+
p.should be_valid
|
11
|
+
}
|
12
|
+
end
|
7
13
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
o_pref.name.should == n_pref.name
|
23
|
-
o_pref.value.should == n_pref.value
|
24
|
-
o_pref.config_id.should == n_pref.config_id
|
14
|
+
it 'should pull a single preference by name' do
|
15
|
+
all = VasPreference.get_all
|
16
|
+
|
17
|
+
o_pref = all[rand(all.count)]
|
18
|
+
o_pref.should_not be nil
|
19
|
+
|
20
|
+
n_pref = VasPreference.get_all(:name=>o_pref.name)[0]
|
21
|
+
n_pref.should_not be nil
|
22
|
+
|
23
|
+
o_pref.name.should == n_pref.name
|
24
|
+
o_pref.value.should == n_pref.value
|
25
|
+
o_pref.config_id.should == n_pref.config_id
|
26
|
+
end
|
25
27
|
end
|
26
28
|
end
|