2 # -*- coding: utf-8 -*-
4 # ------------------------------------------------------------
7 # the opensecurityd as RESTful server
9 # Autor: Mihai Bartha, <mihai.bartha@ait.ac.at>
11 # Copyright (C) 2013 AIT Austrian Institute of Technology
12 # AIT Austrian Institute of Technology GmbH
13 # Donau-City-Strasse 1 | 1220 Vienna | Austria
14 # http://www.ait.ac.at
16 # This program is free software; you can redistribute it and/or
17 # modify it under the terms of the GNU General Public License
18 # as published by the Free Software Foundation version 2.
20 # This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 51 Franklin Street, Fifth Floor,
28 # Boston, MA 02110-1301, USA.
29 # ------------------------------------------------------------
32 # ------------------------------------------------------------
44 class TestVMManager(unittest.TestCase):
52 gvm_mgr = vmmanager.VMManager.getInstance()
55 @unittest.skip("skipping")
56 def testGetTemplateUUID(self):
57 template = vmmanager.VMManager.getTemplateUUID()
58 self.assertIsNotNone(template, "returned no UUID for template")
60 #@unittest.skip("skipping (requires running vmmanager)")
61 def testUpdateTemplate(self):
62 gvm_mgr.updateTemplate()
66 #def tearOffClass(self):
71 if __name__ == '__main__':
72 TestVMManager.setUpClass()
74 suite = unittest.TestLoader().loadTestsFromTestCase(TestVMManager)
75 unittest.TextTestRunner().run(suite)
77 # logger = setupLogger('Cygwin')
80 #man = VMManager.getInstance()
82 #print man.getConnectedRSDs()
83 #print man.getNetworkDrives()
84 #man.genNetworkDrive()
85 #drive_bitmask = ctypes.cdll.kernel32.GetLogicalDrives()
86 #print list(itertools.compress(string.ascii_uppercase, map(lambda x:ord(x) - ord('0'), bin(drive_bitmask)[:1:-1])))
87 #print list(map(chr, range(68, 91)))
88 #print Cygwin.getRegEntry('SYSTEM\CurrentControlSet\Enum\USB', 'VID_1058&PID_0704')[0]
89 #devices = VMManager.getConnectedRSDS()
92 #drives = VMManager.getLogicalDrives()
94 #print VMManager.getDriveType("E")
95 #print VMManager.getVolumeInfo("E")
96 #print VMManager.getNetworkPath("E")
99 #for device in devices.values():
101 # if VMManager.isMassStorageDevice(device):
111 #man.genCertificateISO('SecurityDVM0')
112 #man.guestExecute('SecurityDVM0', '/bin/ls -la')
113 #logger = setupLogger('VMManager')
116 #man.sshExecute('/bin/ls -la', 'SecurityDVM0')
117 #man.sshExecuteX11('/usr/bin/iceweasel', 'SecurityDVM0')
118 #man.removeVM('SecurityDVM0')
119 #man.netUse('192.168.56.134', 'USB\\')
120 #ip = '192.168.56.139'
122 #man.cygwin_path = 'c:\\cygwin64\\bin\\'
123 #man.handleDeviceChange()
124 #print man.listSDVM()
125 #man.configureHostNetworking()
126 #new_vm = man.generateSDVMName()
127 #man.createVM(new_vm)
130 #man.isAvailable('c:')
131 #ip = man.getHostOnlyIP('SecurityDVM0')
132 #man.mapNetworkDrive('h:', '\\\\' + ip + '\Download', None, None)
134 #man.genCertificateISO(new_vm)
135 #man.attachCertificateISO(new_vm)
137 #man.attachCertificateISO(vm_name)
138 #man.guestExecute(vm_name, "ls")
139 #man.sshGuestX11Execute('SecurityDVM1', '/usr/bin/iceweasel')
141 #print man.cygwinPath("C:\Users\BarthaM\VirtualBox VMs\SecurityDVM\.ssh\*")
142 #man.genCertificateISO('SecurityDVM')
143 #man.attachCertificateISO('SecurityDVM')
144 #man.isStorageAttached('SecurityDVM')
145 #man.guestExecute('SecurityDVM', 'sudo apt-get -y update')
146 #man.guestExecute('SecurityDVM', 'sudo apt-get -y upgrade' )
148 #man.stopVM('SecurityDVM')
149 #man.storageDetach('SecurityDVM')
150 #man.changeStorageType('C:\Users\BarthaM\VirtualBox VMs\SecurityDVM\SecurityDVM.vmdk','immutable')
151 #man.storageAttach('SecurityDVM')
154 #cmd = "c:\\cygwin64\\bin\\bash.exe --login -c \"/bin/ls\""