boris 1.0.0.beta.1

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.
Files changed (88) hide show
  1. data/LICENSE.md +9 -0
  2. data/README.md +94 -0
  3. data/boris.gemspec +28 -0
  4. data/doc/Array.html +437 -0
  5. data/doc/Boris.html +230 -0
  6. data/doc/Boris/ConnectionAlreadyActive.html +123 -0
  7. data/doc/Boris/ConnectionFailed.html +127 -0
  8. data/doc/Boris/Connector.html +794 -0
  9. data/doc/Boris/InvalidCredentials.html +131 -0
  10. data/doc/Boris/InvalidOption.html +123 -0
  11. data/doc/Boris/InvalidTargetName.html +123 -0
  12. data/doc/Boris/Lumberjack.html +466 -0
  13. data/doc/Boris/MissingCredentials.html +123 -0
  14. data/doc/Boris/NoActiveConnection.html +123 -0
  15. data/doc/Boris/NoProfileDetected.html +123 -0
  16. data/doc/Boris/Options.html +783 -0
  17. data/doc/Boris/Profiles.html +117 -0
  18. data/doc/Boris/Profiles/Linux.html +1151 -0
  19. data/doc/Boris/Profiles/RedHat.html +875 -0
  20. data/doc/Boris/Profiles/Solaris.html +1230 -0
  21. data/doc/Boris/Profiles/Structure.html +2050 -0
  22. data/doc/Boris/Profiles/UNIX.html +893 -0
  23. data/doc/Boris/Profiles/Windows.html +1846 -0
  24. data/doc/Boris/Profiles/Windows/Windows2003.html +304 -0
  25. data/doc/Boris/Profiles/Windows/Windows2008.html +379 -0
  26. data/doc/Boris/Profiles/Windows/Windows2012.html +304 -0
  27. data/doc/Boris/SNMPConnector.html +512 -0
  28. data/doc/Boris/SSHConnector.html +633 -0
  29. data/doc/Boris/Target.html +2002 -0
  30. data/doc/Boris/WMIConnector.html +1134 -0
  31. data/doc/BorisLogger.html +217 -0
  32. data/doc/Hash.html +195 -0
  33. data/doc/String.html +1246 -0
  34. data/doc/_index.html +420 -0
  35. data/doc/class_list.html +53 -0
  36. data/doc/css/common.css +1 -0
  37. data/doc/css/full_list.css +57 -0
  38. data/doc/css/style.css +328 -0
  39. data/doc/file.README.html +183 -0
  40. data/doc/file_list.html +55 -0
  41. data/doc/frames.html +28 -0
  42. data/doc/index.html +183 -0
  43. data/doc/js/app.js +214 -0
  44. data/doc/js/full_list.js +173 -0
  45. data/doc/js/jquery.js +4 -0
  46. data/doc/method_list.html +1468 -0
  47. data/doc/top-level-namespace.html +126 -0
  48. data/lib/boris.rb +30 -0
  49. data/lib/boris/connectors.rb +47 -0
  50. data/lib/boris/connectors/snmp.rb +56 -0
  51. data/lib/boris/connectors/ssh.rb +110 -0
  52. data/lib/boris/connectors/wmi.rb +186 -0
  53. data/lib/boris/errors.rb +17 -0
  54. data/lib/boris/helpers/array.rb +63 -0
  55. data/lib/boris/helpers/constants.rb +20 -0
  56. data/lib/boris/helpers/hash.rb +8 -0
  57. data/lib/boris/helpers/scrubber.rb +51 -0
  58. data/lib/boris/helpers/string.rb +130 -0
  59. data/lib/boris/lumberjack.rb +47 -0
  60. data/lib/boris/options.rb +86 -0
  61. data/lib/boris/profiles/linux/redhat.rb +77 -0
  62. data/lib/boris/profiles/linux_core.rb +216 -0
  63. data/lib/boris/profiles/unix/solaris.rb +307 -0
  64. data/lib/boris/profiles/unix_core.rb +85 -0
  65. data/lib/boris/profiles/windows/windows2003.rb +15 -0
  66. data/lib/boris/profiles/windows/windows2008.rb +23 -0
  67. data/lib/boris/profiles/windows/windows2012.rb +15 -0
  68. data/lib/boris/profiles/windows_core.rb +530 -0
  69. data/lib/boris/structure.rb +167 -0
  70. data/lib/boris/target.rb +340 -0
  71. data/test/connector_tests/test_snmp.rb +35 -0
  72. data/test/connector_tests/test_ssh.rb +51 -0
  73. data/test/connector_tests/test_wmi.rb +129 -0
  74. data/test/helper_tests/test_array.rb +25 -0
  75. data/test/helper_tests/test_hash.rb +10 -0
  76. data/test/helper_tests/test_string.rb +136 -0
  77. data/test/profile_tests/test_core_skeleton +107 -0
  78. data/test/profile_tests/test_linux_core.rb +331 -0
  79. data/test/profile_tests/test_redhat.rb +134 -0
  80. data/test/profile_tests/test_solaris.rb +523 -0
  81. data/test/profile_tests/test_unix_core.rb +117 -0
  82. data/test/profile_tests/test_windows.rb +536 -0
  83. data/test/setup_tests.rb +14 -0
  84. data/test/test_all.rb +8 -0
  85. data/test/test_options.rb +44 -0
  86. data/test/test_structure.rb +136 -0
  87. data/test/test_target.rb +146 -0
  88. metadata +241 -0
@@ -0,0 +1,35 @@
1
+ require 'ostruct'
2
+ require 'setup_tests'
3
+
4
+ class SNMPTest < Test::Unit::TestCase
5
+ context 'a target listening for SNMP requests' do
6
+ setup do
7
+ @target_name = '0.0.0.0'
8
+ @cred = {:user=>'someuser', :password=>'somepass'}
9
+ @connector = SNMPConnector.new(@target_name, @cred, Options.new)
10
+
11
+ @transport = mock('SNMP')
12
+
13
+ SNMP::Manager.stubs(:new).returns(@transport)
14
+
15
+ @expected_value = {:name=>'sysDescr.0', :value=>'string'}
16
+
17
+ @transport.stubs(:walk).with('sysDescr').yields([OpenStruct.new(@expected_value)])
18
+ end
19
+
20
+ should 'allow us to connect to it' do
21
+ assert_kind_of(SNMPConnector, @connector.establish_connection)
22
+ end
23
+
24
+ context 'to which we have already connected' do
25
+ setup do
26
+ @connector.establish_connection
27
+ end
28
+
29
+ should 'allow us to perform a simple SNMP GET' do
30
+ assert_equal(@expected_value, @connector.value_at('sysDescr'))
31
+ assert_equal([@expected_value], @connector.values_at('sysDescr'))
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,51 @@
1
+ require 'setup_tests'
2
+
3
+ class SSHTest < Test::Unit::TestCase
4
+ context 'a target listening for SSH connections' do
5
+ setup do
6
+ @target_name = '0.0.0.0'
7
+ @cred = {:user=>'someuser', :password=>'somepass'}
8
+ @connector = SSHConnector.new(@target_name, @cred, Options.new)
9
+
10
+ @transport = mock('SSHConnector')
11
+
12
+ Net::SSH.stubs(:start).returns(@transport)
13
+
14
+ @expected_data = 'SunOS'
15
+ end
16
+
17
+ should 'allow us to connect to it via SSH' do
18
+ assert_kind_of(SSHConnector, @connector.establish_connection)
19
+ end
20
+
21
+ context 'to which we have already connected' do
22
+ setup do
23
+ @connector.establish_connection
24
+
25
+ @channel = mock('channel')
26
+ @transport.stubs(:open_channel).returns(@channel).then.yields(@channel)
27
+ @channel.stubs(:on_data).yields(@channel, @expected_data)
28
+ @channel.stubs(:on_extended_data).returns(@channel)
29
+ @channel.stubs(:on_close).returns
30
+ @channel.expects(:exec).at_least_once
31
+ @channel.expects(:wait).at_least_once
32
+ end
33
+
34
+ should 'allow us to retrieve data' do
35
+ assert_equal(@expected_data, @connector.value_at('uname'))
36
+ assert_equal([@expected_data], @connector.values_at('uname'))
37
+ end
38
+
39
+ # should 'reconnect if a channel was closed prematurely' do
40
+ # @connector.expects(:establish_connection).once #more
41
+ # @channel.stubs(:on_close).yields(@channel)
42
+ # assert_equal(@expected_data, @connector.value_at('uname'))
43
+ # end
44
+
45
+ should 'request pty if needed' do
46
+ @channel.expects(:request_pty).once
47
+ assert_equal(@expected_data, @connector.value_at('uname', true))
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,129 @@
1
+ require 'setup_tests'
2
+
3
+ class WMITest < Test::Unit::TestCase
4
+ context 'a target listening for WMI connections' do
5
+ setup do
6
+ skip("test relies on WIN32OLE")
7
+
8
+ @target_name = '0.0.0.0'
9
+ @cred = {:user=>'someuser', :password=>'somepass'}
10
+ @connector = WMIConnector.new(@target_name, @cred, Options.new)
11
+
12
+ @win32ole = mock('WIN32OLE')
13
+
14
+ WIN32OLE.stubs(:new).with('WbemScripting.SWbemLocator').returns(@win32ole)
15
+
16
+ ['root\cimv2', 'root\WMI', 'root\default'].each do |namespace|
17
+ @win32ole.stubs(:ConnectServer).with(@target_name, namespace, @cred[:user], @cred[:password], nil, nil, 128).returns(@win32ole)
18
+ end
19
+ @win32ole.stubs(:Get).with('StdRegProv').returns(@win32ole)
20
+
21
+ @connector.establish_connection
22
+ end
23
+
24
+ context 'to which we have already connected' do
25
+ setup do
26
+ @row = mock('row')
27
+
28
+ @property = mock('property')
29
+
30
+ @win32ole.stubs(:ExecQuery).returns([@row])
31
+ @row.stubs(:Properties_).returns([@property])
32
+ end
33
+
34
+ should 'allow us to get property values with a wmi query from the cimv2 namespace via #execute' do
35
+ @property.stubs(:Name).returns('Name')
36
+ @property.stubs(:Value).returns('Windows Server 2008')
37
+ assert_equal({:name=>'Windows Server 2008'}, @connector.value_at('SELECT Name FROM Win32_OperatingSystem'))
38
+ end
39
+
40
+ should 'allow us to get property values with a wmi query from the root wmi namespace via #execute' do
41
+ @property.stubs(:Name).returns('InstanceName')
42
+ @property.stubs(:Value).returns('VMware Accelerated AMD PCNet Adapter')
43
+ assert_equal([:instancename=>'VMware Accelerated AMD PCNet Adapter'], @connector.values_at('SELECT * FROM MSNdis_HardwareStatus', :root_wmi))
44
+ end
45
+
46
+ should 'allow us to get attribute values from a wmi query via #execute' do
47
+ attribute = mock('attribute')
48
+ @row.stubs(:Attributes).returns(attribute)
49
+ attribute.stubs(:Properties_).returns([@property])
50
+
51
+ @property.stubs(:Name).returns('PortType')
52
+ @property.stubs(:Value).returns(1)
53
+
54
+ assert_equal([:porttype=>1], @connector.values_at('SELECT * FROM MSFC_FibrePortHBAAttributes', :root_wmi))
55
+ end
56
+
57
+ should 'error if an invalid limit for query is specified' do
58
+ assert_raise(ArgumentError) {@connector.values_at('select * from something', nil, '5')}
59
+ end
60
+ end
61
+
62
+ context 'to which we want to connect via the registry namespace' do
63
+ setup do
64
+ #@target.connect
65
+
66
+ win32ole = mock('win32ole')
67
+
68
+ @registry = @connector.registry = win32ole
69
+ @registry.stubs(:Methods_).returns(win32ole)
70
+ @registry.stubs(:inParameters).returns(win32ole)
71
+ @registry.stubs(:SpawnInstance_).returns(win32ole)
72
+ @registry.stubs(:ExecMethod_).returns(win32ole)
73
+ @registry.stubs(:hDefKey=)
74
+ @registry.stubs(:sSubKeyName=)
75
+ end
76
+
77
+ should 'allow us to see if we have permissions to read certain registry keys via #has_access_for' do
78
+ @registry.stubs(:uRequired=)
79
+ @registry.stubs(:bGranted).returns(true)
80
+
81
+ assert(@connector.has_access_for('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT'))
82
+ end
83
+
84
+ should 'allow us to access registry keys via #subkeys_at' do
85
+ @connector.stubs(:has_access_for).returns(true)
86
+
87
+ @registry.stubs(:sNames).returns(['CurrentVersion'])
88
+
89
+ expected_data = ['HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion']
90
+
91
+ assert_equal(expected_data, @connector.registry_subkeys_at('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT'))
92
+ end
93
+
94
+ context 'and read values' do
95
+ setup do
96
+ @key_path = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
97
+ @connector.stubs(:has_access_for).returns(true)
98
+ @registry.stubs(:sValueName=)
99
+ @expected_data = {}
100
+ end
101
+
102
+ should 'return an empty hash from #values_at when the path does not exist' do
103
+ @registry.stubs(:sNames).returns([])
104
+
105
+ @expected_data[:key_path] = 'HKEY_LOCAL_MACHINE\i\dont\exist'
106
+ assert_equal({}, @connector.registry_values_at(@expected_data[:key_path]))
107
+ end
108
+
109
+ should 'allow us to access string values from the registry via #values_at' do
110
+ @registry.stubs(:sNames).returns(['ProductName'])
111
+ @registry.stubs(:sValue).returns('Microsoft Windows Server 2008 R2')
112
+ @registry.stubs(:uValue).returns(nil)
113
+
114
+ @expected_data = {:productname=>'Microsoft Windows Server 2008 R2'}
115
+ assert_equal(@expected_data, @connector.registry_values_at(@key_path))
116
+ end
117
+
118
+ should 'allow us to access other values from the registry via #values_at' do
119
+ @registry.stubs(:sNames).returns(['InstallDate'])
120
+ @registry.stubs(:sValue).returns(nil)
121
+ @registry.stubs(:uValue).returns(123456)
122
+
123
+ @expected_data = {:installdate=>123456}
124
+ assert_equal(@expected_data, @connector.registry_values_at(@key_path))
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,25 @@
1
+ require 'setup_tests'
2
+
3
+ class ArrayTest < Test::Unit::TestCase
4
+ context 'the Array class' do
5
+ should 'return the product key for a microsoft product via #to_ms_product_key' do
6
+ product_key_binary = [164, 1, 1, 0, 3, 0, 0, 0, 53, 53, 48, 52, 49, 45, 49, 56, 54, 45, 48, 49, 51, 51, 48,
7
+ 51, 53, 45, 55, 53, 55, 54, 51, 0, 151, 0, 0, 0, 88, 49, 52, 45, 50, 51, 56, 57, 54, 0, 0, 0, 0, 0, 0, 0,
8
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
9
+
10
+ assert_equal('BBBBB-BBBBB-BBBBB-BBBBB-BBBBB', product_key_binary.to_ms_product_key)
11
+ end
12
+
13
+ should 'return each item of an array as a nil-values key-value pair via #to_nil_hash' do
14
+ assert_equal({:value_one=>nil, :value_two=>nil}, ['value_one', 'value_two'].to_nil_hash)
15
+ end
16
+
17
+ should 'return the wwn of an array via #to_wwn' do
18
+ assert_equal('00000000aaaaaaaa', [0, 0, 0, 0, 170, 170, 170, 170].to_wwn)
19
+ end
20
+
21
+ should 'recursively strip the string values within an array via #strip_string_values_in_array' do
22
+ assert_equal([1, 'a', 'c', ['x', 'y']], [1, 'a ', ' c ', [' x ', ' y ']].strip_string_values_in_array)
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,10 @@
1
+ require 'setup_tests'
2
+
3
+ class HashTest < Test::Unit::TestCase
4
+ context 'the Hash class' do
5
+ should 'recursivley strip the string values inside of a Hash via #strip_string_values_in_hash' do
6
+ assert_equal({:someval=>'strip this', :somearray=>['this too!']},
7
+ {:someval=>' strip this ', :somearray=>[' this too!']}.strip_string_values_in_hash)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,136 @@
1
+ require 'setup_tests'
2
+
3
+ class StringTest < Test::Unit::TestCase
4
+ context 'the String class' do
5
+ should 'return the last chunk of text after a colon via #after_colon' do
6
+ assert_equal('C', 'AB:C'.after_colon)
7
+ assert_equal('C', 'A:B:C'.after_colon)
8
+ assert_equal(nil, 'ABC'.after_colon)
9
+ end
10
+
11
+ should 'return the last chunk of text after a period via #after_period' do
12
+ assert_equal('C', 'AB.C'.after_period)
13
+ assert_equal('C', 'A.B.C'.after_period)
14
+ assert_equal(nil, 'ABC'.after_period)
15
+ end
16
+
17
+ should 'return the last chunk of text after a pipe via #after_pipe' do
18
+ assert_equal('C', 'AB|C'.after_pipe)
19
+ assert_equal('C', 'A|B|C'.after_pipe)
20
+ assert_equal(nil, 'ABC'.after_pipe)
21
+ end
22
+
23
+ should 'return the last chunk of text after a slash via #after_slash' do
24
+ assert_equal('C', 'A/B/C'.after_slash)
25
+ assert_equal('C', 'A\B\C'.after_slash)
26
+ assert_equal(nil, 'ABCD'.after_slash)
27
+ end
28
+
29
+ should 'return the first chunk of text before a colon via #before_colon' do
30
+ assert_equal('AB', 'AB:C'.before_colon)
31
+ assert_equal('A', 'A:B:C'.before_colon)
32
+ assert_equal(nil, 'ABC'.before_colon)
33
+ end
34
+
35
+ should 'return the first chunk of text before a period via #before_period' do
36
+ assert_equal('AB', 'AB.C'.before_period)
37
+ assert_equal('A', 'A.B.C'.before_period)
38
+ assert_equal(nil, 'ABC'.before_period)
39
+ end
40
+
41
+ should 'return the first chunk of text after a pipe via #before_pipe' do
42
+ assert_equal('AB', 'AB|C'.before_pipe)
43
+ assert_equal('A', 'A|B|C'.before_pipe)
44
+ assert_equal(nil, 'ABC'.before_pipe)
45
+ end
46
+
47
+ should 'return the first chunk of text after a slash via #before_slash' do
48
+ assert_equal('A', 'A/B/C'.before_slash)
49
+ assert_equal('A', 'A\B\C'.before_slash)
50
+ assert_equal(nil, 'ABCD'.before_slash)
51
+ end
52
+
53
+ should 'return the value between a pair of parenthesis via #between_parenthesis' do
54
+ assert_equal('a test string', 'this is (a test string)'.between_parenthesis)
55
+ assert_equal('', 'this is a test () string'.between_parenthesis)
56
+ assert_equal(nil, 'this is a test'.between_parenthesis)
57
+ end
58
+
59
+ should 'return the proper name of a model via #format_model' do
60
+ assert_equal('Product X 1000', 'Product X 1000 server'.format_model)
61
+ assert_equal('SunBlade 100', 'sun blade 100'.format_model)
62
+ assert_equal('SunFire 100', 'sun fire 100'.format_model)
63
+ assert_equal('SPARC Enterprise T1000', 'T1000'.format_model)
64
+ assert_equal('BIG-IP 1000', 'bigip 1000'.format_model)
65
+ assert_equal('Catalyst 1000', 'WSC1000'.format_model)
66
+ assert_equal('Catalyst 1000-E', 'WSC1000E'.format_model)
67
+ assert_equal('Catalyst 1000-E', 'WSC1000-E'.format_model)
68
+ assert_equal('System x1000 M3', 'IBM System x1000 M3'.format_model)
69
+ assert_equal('System x1000 M3', 'IBM System x1000 M3 -[123456]-'.format_model)
70
+ end
71
+
72
+ should 'return the proper serial number via #format_serial' do
73
+ assert_equal('ABC123', 'abc123'.format_serial)
74
+ assert_equal(nil, 'None'.format_serial)
75
+ end
76
+
77
+ should 'return the proper name of a vendor via #format_vendor' do
78
+ assert_equal(VENDOR_AMD, 'amd'.format_vendor)
79
+ assert_equal(VENDOR_AMD, 'authenticamd'.format_vendor)
80
+ assert_equal(VENDOR_BROCADE, 'brocade communications'.format_vendor)
81
+ assert_equal(VENDOR_CITRIX, 'citrix'.format_vendor)
82
+ assert_equal(VENDOR_DELL, 'dell'.format_vendor)
83
+ assert_equal(VENDOR_EMULEX, 'emulex'.format_vendor)
84
+ assert_equal(VENDOR_HP, 'compaq'.format_vendor)
85
+ assert_equal(VENDOR_HP, 'hp'.format_vendor)
86
+ assert_equal(VENDOR_HP, 'hp inc'.format_vendor)
87
+ assert_equal(VENDOR_HP, 'hewlett packard'.format_vendor)
88
+ assert_equal(VENDOR_IBM, 'ibm'.format_vendor)
89
+ assert_equal(VENDOR_INTEL, 'genuineintel'.format_vendor)
90
+ assert_equal(VENDOR_INTEL, 'intel corp'.format_vendor)
91
+ assert_equal(VENDOR_MICROSOFT, 'microsoft'.format_vendor)
92
+ assert_equal(VENDOR_ORACLE, 'oracle'.format_vendor)
93
+ assert_equal(VENDOR_ORACLE, 'sun'.format_vendor)
94
+ assert_equal(VENDOR_ORACLE, 'sunw'.format_vendor)
95
+ assert_equal(VENDOR_ORACLE, 'sun microsystems'.format_vendor)
96
+ assert_equal(VENDOR_QLOGIC, 'qlogic'.format_vendor)
97
+ assert_equal(VENDOR_REDHAT, 'redhat'.format_vendor)
98
+ assert_equal(VENDOR_REDHAT, 'red hat'.format_vendor)
99
+ assert_equal(VENDOR_SUSE, 'suse linux'.format_vendor)
100
+ assert_equal(VENDOR_VMWARE, 'vmware'.format_vendor)
101
+
102
+ assert_equal('Some other vendor', 'Some other vendor'.format_vendor)
103
+ assert_equal(nil, ''.format_vendor)
104
+ end
105
+
106
+ should 'return the ip-formatted value from a string of hex values via #hex_to_address' do
107
+ assert_equal('255.255.255.0', 'ffffff00'.hex_to_address)
108
+ end
109
+
110
+ should 'remove the architecture from a string via #remove_arch' do
111
+ assert_equal('Microsoft SQL Server 2008', 'Microsoft SQL Server 2008 32 bit'.remove_arch)
112
+ assert_equal('Microsoft SQL Server 2008', 'Microsoft SQL Server 2008 32-bit'.remove_arch)
113
+ assert_equal('Microsoft SQL Server 2008', 'Microsoft SQL Server 2008 (32-bit)'.remove_arch)
114
+ assert_equal('Microsoft SQL Server 2008', 'Microsoft SQL Server 2008 (64-bit)'.remove_arch)
115
+ assert_equal('Microsoft SQL Server 2008', 'Microsoft SQL Server 2008'.remove_arch)
116
+
117
+ test_string = 'Microsoft SQL Server 2008 32 bit'
118
+ test_string.remove_arch!
119
+ assert_equal('Microsoft SQL Server 2008', test_string)
120
+ end
121
+
122
+ should 'remove unnecessary characters from a string via #string_clean' do
123
+ assert_equal('this has an invalid character', "this has an invalid\u00A0 character".string_clean)
124
+ assert_equal('this should be stripped', ' this should be stripped '.string_clean)
125
+ assert_equal('this should be stripped', ' this should be stripped '.string_clean)
126
+ assert_equal('registered', 'registered(r)'.string_clean)
127
+ end
128
+
129
+ should 'return the value(s) found between at least one pair of single or double quotes via #within_quotes' do
130
+ assert_equal(['C'], 'AB"C"'.within_quotes)
131
+ assert_equal(['A', 'C'], '"A" B "C"'.within_quotes)
132
+ assert_equal(['A', 'C'], "'A' B 'C'".within_quotes)
133
+ assert_equal(nil, 'ABC'.within_quotes)
134
+ end
135
+ end
136
+ end
@@ -0,0 +1,107 @@
1
+ require 'setup_tests'
2
+
3
+ class WindowsCoreTest < Test::Unit::TestCase
4
+ context 'a Windows target' do
5
+ setup do
6
+ @target_name = '0.0.0.0'
7
+ @target = Target.new(@target_name)
8
+ @connector = @target.connector = instance_of(WMIConnector)
9
+
10
+ @target.detect_profile
11
+ end
12
+
13
+ should 'detect when a target should use the Win2008 profile' do
14
+ assert_equal(Profiles::Win2008, @target.target_profile)
15
+ end
16
+
17
+ context 'being scanned' do
18
+ setup do
19
+ end
20
+
21
+ context 'for file system information' do
22
+ setup do
23
+ end
24
+
25
+ should 'return file system information via #get_file_systems' do
26
+ end
27
+ end
28
+
29
+ context 'for hardware information' do
30
+ setup do
31
+ end
32
+
33
+ should 'return hardware information via #get_hardware' do
34
+ end
35
+ end
36
+
37
+ context 'for hosted shares' do
38
+ setup do
39
+ end
40
+
41
+ should 'return hosted share information via #get_hosted_shares' do
42
+ end
43
+ end
44
+
45
+ context 'for installed applications' do
46
+ setup do
47
+ end
48
+
49
+ should 'return installed applications via #get_installed_applications' do
50
+ end
51
+ end
52
+
53
+ context 'for installed patches' do
54
+ should 'parse out the patches from the registry location for applications' do
55
+ end
56
+ end
57
+
58
+ context 'for installed services' do
59
+ setup do
60
+ end
61
+
62
+ should 'return service information via #get_installed_services' do
63
+ end
64
+ end
65
+
66
+ context 'for local users and groups' do
67
+ should 'allow us to detect the user name of an account from its guid via #get_username' do
68
+ end
69
+
70
+ should 'return local user groups and accounts via #get_local_user_groups if the server is not a domain controller' do
71
+ end
72
+ end
73
+
74
+ context 'for network identification' do
75
+ setup do
76
+ end
77
+
78
+ should 'return the network identification via #get_network_id' do
79
+ end
80
+ end
81
+
82
+ context 'for network interfaces' do
83
+ setup do
84
+ end
85
+
86
+ should 'return ethernet interface information via #get_network_interfaces' do
87
+ end
88
+
89
+ should 'return fibre channel interface information via #get_network_interfaces' do
90
+ end
91
+ end
92
+
93
+ context 'for operating system information' do
94
+ setup do
95
+ end
96
+
97
+ should 'return operating system information via #get_operating_system' do
98
+ end
99
+ end
100
+
101
+ context 'for system roles' do
102
+ should 'return a list of system roles via #get_system_roles' do
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end