Commits

Moises Henriquez  committed 27c13cd

Fixed references in test code to reflect naming convention change

  • Participants
  • Parent commits ac7e5a5

Comments (0)

Files changed (18)

File src/tests/test_BOOTMODE.py

-#!/usr/bin/env python
-
-#    This file is part of VASM.
-#
-#    VASM is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License v3 as published by
-#    the Free Software Foundation.
-#
-#    VASM is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License
-#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
-
-__author__ = "Moises Henriquez"
-__author_email__ = "moc.liamg@xnl.E0M"[::-1]
-
-
-import os
-import sys
-import shutil
-import unittest
-vasmdir = os.path.join(os.path.dirname(
-    os.path.dirname(os.path.abspath(__file__))), 'vasm')
-if not vasmdir in sys.path: sys.path.append(vasmdir)
-from backend import BOOTMODE
-
-
-
-class BootModeTest(unittest.TestCase):
-    def setUp(self):
-        self.file = "/tmp/inittab"
-        shutil.copy2("/etc/inittab", "/tmp/inittab")
-        self.model = BOOTMODE.InitTab(self.file)
-        self._original_data = []
-        with open(self.file) as file:
-            for line in file:
-                self._original_data.append(line)
-        
-    
-    def tearDown(self):
-        # remove the temp file
-        os.remove("/tmp/inittab")
-    
-    def test_methods(self):
-        """ Test to make sure the class has the right methods """
-        self.assertTrue(callable(self.model.getMode))
-        self.assertTrue(callable(self.model.setMode))
-
-    def test_getMode(self):
-        mode = self.model.getMode()
-        self.assertTrue(type(mode) == int)
-    
-    def test_setMode(self):
-        # copy the file to tmp
-        mode = 3
-        self.model.setMode(mode)
-        # make sure when we read it, it comes back the same as it went in
-        result = self.model.getMode()
-        self.assertEqual(mode, result)
-        
-        # Check that this method raises an exception if fed the wrong values
-        self.assertRaises(AssertionError, self.model.setMode, 0)
-        self.assertRaises(AssertionError, self.model.setMode, 6)
-
-if __name__ == "__main__":
-    unittest.main()

File src/tests/test_DATESET.py

-
-#!/usr/bin/env python
-# -*- encoding: utf-8 -*-
-
-#    This file is part of VASM.
-#
-#    VASM is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License v3 as published by
-#    the Free Software Foundation.
-#
-#    VASM is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License
-#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
-
-
-import unittest
-import os
-import sys
-vasmdir = os.path.join(os.path.dirname(
-    os.path.dirname(os.path.abspath(__file__))), 'vasm')
-if not vasmdir in sys.path: sys.path.append(vasmdir)
-from backend import DATESET
-
-class ClockTest(unittest.TestCase):
-    """ Test the functionality to set the hardware clock """
-    def setUp(self):
-        self.clock = DATESET.HWClock()
-        super(ClockTest, self).setUp()
-        self.dummyvalue = "localtime"
-
-    def test_setClock(self):
-        # This will except if something goes wrong
-        self.clock.set_value(self.dummyvalue)
-        gotval = self.clock.get_value()
-        return self.assertEqual(gotval, self.dummyvalue)
-
-    def test_invalid_values(self):
-        self.assertRaises(AssertionError,
-                          self.clock.set_value, "foo")
-        self.assertRaises(AssertionError,
-                          self.clock.set_value, "")
-        
-
-class TimeZoneTest(unittest.TestCase):
-    """ Test timezone setting and getting """
-    def setUp(self):
-        self.zone = DATESET.TimeZone()
-        super(TimeZoneTest, self).setUp()
-        self.zonesbase = "/usr/share/zoneinfo/"
-        self.tz = "US/Eastern"
-
-    def test_setEmtyZone(self):
-        self.assertRaises(AssertionError,
-                          self.zone.set_zone, "")
-        return self.assertRaises(AssertionError,
-                                 self.zone.set_zone, None)
-
-    def test_setzone(self):
-        ret = self.zone.set_zone(self.tz)
-        return self.assertTrue(ret)
-
-    def test_getzone(self):
-        # set the zone.
-        self.assertTrue(self.zone.set_zone(self.tz))
-        zone = self.zone.get_zone()
-        return self.assertEqual(zone, self.tz)
-
-    def test_verify_with_filesystem(self):
-        # we must set it again
-        self.assertTrue(self.zone.set_zone(self.tz))
-        rlink = os.readlink("/etc/localtime-copied-from")
-        return self.assertEqual(rlink, os.path.join(self.zonesbase, self.tz))
-
-
-class DateTimeTest(unittest.TestCase):
-    """ Test the functionality to set and get the system time """
-
-    def setUp(self):
-        super(DateTimeTest, self).setUp()
-        self.date_time = DATESET.DateTime()
-
-        # save current time for restoring it later
-        self.now = self.date_time._date_time
-        self.date = self.now.year, self.now.month, self.now.day
-        self.time = self.now.hour, self.now.minute, self.now.second
-
-    def tearDown(self):
-        super(DateTimeTest, self).tearDown()
-        dt = self.date_time
-        dt.year, dt.month, dt.day = self.date
-        dt.hour, dt.minute, dt.second = self.time
-        self.date_time.set_date_and_time()
-
-    def testSetDate(self):
-
-        # test day and month < 10
-        self.date_time.year += 1
-        self.date_time.month = 2
-        self.date_time.day = 2
-        self.date_time.set_date()
-        current_date = DATESET.DateTime()
-        self.assertEqual(current_date.year, self.date[0] + 1)
-        self.assertEqual(self.date_time.year, current_date.year)
-        self.assertEqual(self.date_time.month, current_date.month)
-        self.assertEqual(self.date_time.day, current_date.day)
-
-        # test day and month > 10
-        self.date_time.month = 12
-        self.date_time.day = 24
-        self.date_time.set_date()
-        current_date = DATESET.DateTime()
-        self.assertEqual(current_date.year, self.date[0] + 1)
-        self.assertEqual(self.date_time.year, current_date.year)
-        self.assertEqual(self.date_time.month, current_date.month)
-        self.assertEqual(self.date_time.day, current_date.day)
-
-    def testSetTime(self):
- 
-        self.date_time.hour += 1
-        self.date_time.minute += 1
-        self.date_time.second = 0
-        self.date_time.set_time()
-        current_time = DATESET.DateTime()
-        self.assertEqual(current_time.hour, self.time[0] + 1)
-        self.assertEqual(current_time.minute, self.time[1] + 1)
-        self.assertEqual(self.date_time.hour, current_time.hour)
-        self.assertEqual(self.date_time.minute, current_time.minute)
-        self.assertAlmostEqual(self.date_time.second, current_time.second)
-
-
-if __name__ == "__main__":
-    assert os.getuid() == 0, "You need to be root for running DateTime tests"
-    unittest.main()

File src/tests/test_FSTAB.py

-#!/usr/bin/env python
-
-#    This file is part of VASM.
-#
-#    VASM is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License v3 as published by
-#    the Free Software Foundation.
-#
-#    VASM is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License
-#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
-
-__author__ = "Moises Henriquez"
-__author_email__ = "moc.liamg@xnl.E0M"[::-1]
-
-import unittest
-import os
-import sys
-vasmdir = os.path.join(os.path.dirname(
-    os.path.dirname(os.path.abspath(__file__))), 'vasm')
-if not vasmdir in sys.path: sys.path.append(vasmdir)
-import unittest
-from backend import FSTAB
-from shutil import copy2
-
-class FstabTest(unittest.TestCase):
-    def setUp(self):
-        # create a copy of /etc/fstab so we can play with it
-        self.datapath = '/tmp/test_fstab'
-        copy2('/etc/fstab', self.datapath)
-        self.datamodel = FSTAB.FstabModel(self.datapath)
-        self.fake_entry = FSTAB.FstabEntry()
-        self.fake_entry.device = "/dev/sdz1"
-        self.fake_entry.mountpoint = "fake_mount_point"
-        self.fake_entry.filesystem = "ext2"
-        self.fake_entry.options = "defaults 1 0"
-        return
-
-    def test_check_for_entry(self):
-        # Check if an entry exists
-        # We have not yet added fake_entry, so this should return False
-        self.assertTrue(self.datamodel.hasEntry(self.fake_entry.device) is False)
-
-    def test_add_entry(self):
-        # Check if we can add an entry
-        self.datamodel.addEntry(self.fake_entry)
-        # now check if we have the entry there
-        self.assertTrue(self.datamodel.hasEntry(self.fake_entry.device))
-
-    def test_remove_entry(self):
-        # Check if we can remove an entry
-        self.datamodel.addEntry(self.fake_entry)
-        self.assertTrue(self.datamodel.hasEntry(self.fake_entry.device))
-        self.datamodel.removeEntry(self.fake_entry.device)
-        self.assertTrue(self.datamodel.hasEntry(self.fake_entry.device) is False)
-
-    def test_invalid_entry_argument(self):
-        # Make sure it raises an exception if we give it a string
-        self.assertRaises(AssertionError,
-                          self.datamodel.addEntry, 'foo')
-
-    def test_incomplete_entry_attributes(self):
-        # make sure we raise an exception when the attributes of the entry are not complete
-        entry = FSTAB.FstabEntry() # empty entry
-        self.assertRaises(AssertionError,
-                          self.datamodel.addEntry, entry)
-        
-    def tearDown(self):
-        """ Remove the file when we're done """
-        return os.remove(self.datapath)
-
-
-if __name__ == "__main__":
-    assert os.geteuid() == 0, "You must be root to run tests on /etc/fstab """
-    unittest.main()
-

File src/tests/test_LOGINMANAGERS.py

-#!/usr/bin/env python
-
-#    This file is part of VASM.
-#
-#    VASM is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License v3 as published by
-#    the Free Software Foundation.
-#
-#    VASM is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License
-#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
-
-__author__ = "Moises Henriquez"
-__author_email__ = "moc.liamg@xnl.E0M"[::-1]
-
-import sys
-import os
-import shutil
-import unittest
-vasmdir = os.path.join(os.path.dirname(
-    os.path.dirname(os.path.abspath(__file__))), 'vasm')
-if not vasmdir in sys.path: sys.path.append(vasmdir)
-from backend import LOGINMANAGERS as gestores
-
-
-class BootModeTest(unittest.TestCase):
-    def setUp(self):
-        self.file = "/tmp/rc.X"
-        shutil.copy2("/etc/rc.d/rc.X", "/tmp/rc.X")
-        self.model = gestores.LoginManagers(specfile=self.file)
-    
-    def tearDown(self):
-        # remove the temp file
-        os.remove(self.file)
-        
-    def test_getCurrent(self):
-        gestor = self.model.get_current()
-        self.assertTrue(type(gestor) == str)
-    
-    def test_setMode(self):
-        # copy the file to tmp
-        manager = "FOO"
-        res = self.model.set_manager("FOO")
-        read_man = self.model.get_current()
-        self.assertEqual(read_man, manager)
-    
-    def test_roundTest(self):
-        man = "BAR"
-        # set the mode
-        res = self.model.set_manager(man)
-        # read it to make sure it comes back the same
-        read = self.model.get_current()
-        self.assertEqual(read, man)
-    
-    def test_managers(self):
-        res = self.model.list_existing()
-        self.assertTrue(len(res) > 0)
-    
-    def test_descriptions(self):
-        manager = self.model.list_existing()[0].lower()
-        res = self.model._describe_manager(manager)
-        self.assertTrue(type(res), str)
-        
-        
-        
-        
-
-if __name__ == "__main__":
-    unittest.main()

File src/tests/test_NETWORKING.py

-#!/usr/bin/env python
-
-#    This file is part of VASM.
-#
-#    VASM is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License v3 as published by
-#    the Free Software Foundation.
-#
-#    VASM is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License
-#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
-
-""" test_NETWORKING.py
-Test suite for the networking module"""
-__author__ = "Moises Henriquez"
-__author_email__ = "moc.liamg@xnl.E0M"[::-1]
-
-import os
-import sys
-vasmdir = os.path.join(os.path.dirname(
-    os.path.dirname(os.path.abspath(__file__))), 'vasm')
-if not vasmdir in sys.path: sys.path.append(vasmdir)
-import unittest
-from backend import NETWORKING
-
-class NetworkingTests(unittest.TestCase):
-    def setUp(self):
-        self.addCleanup(self._cleanup)
-        self.assertTrue(hasattr(NETWORKING, 'NetConfModel'))
-        self.hostname = 'foo.host.vnet'
-        self.host_file = '/tmp/hostnamefile'
-        self.model = NETWORKING.NetConfModel(host_file=self.host_file)
-    
-    def tearDown(self):
-        return self._cleanup()
-    
-    def _cleanup(self):
-        if os.path.exists(self.host_file):
-            os.remove(self.host_file)
-    
-    def testCreateNic(self):
-        # Create a fake nic object
-        mynic = NETWORKING.Nic('wlan10')
-        # The config file should not exist
-        self.assertTrue(not os.path.exists(mynic.inet.fpath))
-        self.assertEqual(mynic.inet.config['DEVICE'], mynic.devname)
-        # Disabling this nic should raise an exception because the
-        # config file does not exist
-        self.assertRaises(AssertionError, mynic.disable)
-    
-    def testHostnameWriteRead(self):
-        # writing an empty hostname raise exception
-        self.model.hostname = ""
-        self.assertRaises(AssertionError, self.model.set_hostname)
-        self.model.hostname = None
-        self.assertRaises(AssertionError, self.model.set_hostname)
-        # Passing an argument to set_hostname will raise TypeError
-        self.assertRaises(TypeError, self.model.set_hostname, 'foo')
-        
-        # write the hostname
-        self.model.hostname = self.hostname
-        self.model.set_hostname()
-        readname = self.model.get_hostname()
-        return self.assertEqual(readname, self.hostname)
-
-
-if __name__ == '__main__':
-    assert os.geteuid() == 0, "Only root is allowed to run these tests."""
-    unittest.main()

File src/tests/test_SERVICES.py

-#!/usr/bin/env python
-
-#    This file is part of VASM.
-#
-#    VASM is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License v3 as published by
-#    the Free Software Foundation.
-#
-#    VASM is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License
-#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
-
-__author__ = "Moises Henriquez"
-__author_email__ = "moc.liamg@xnl.E0M"[::-1]
-
-import unittest
-import os
-import sys
-vasmdir = os.path.join(os.path.dirname(
-    os.path.dirname(os.path.abspath(__file__))), 'vasm')
-if not vasmdir in sys.path: sys.path.append(vasmdir)
-from backend import SERVICES as services
-
-class ServicesTests(unittest.TestCase):
-    def setUp(self):
-        self.datamodel = services.ServiceModel()
-        self.fake_service = self.datamodel.list_all_services()[0]
-        self.fake_runlevel = 4
-
-    def test_EnableService(self):
-        code, output = self.datamodel.enable_service(self.fake_service,
-                                                     self.fake_runlevel)
-        # subprocess will return > 0 if this fails
-        self.assertEqual(code, 0)
-        # this return True when service is enabled, False otherwise
-        # should be enabled now
-        val = self.datamodel.get_service_runlevel_status(self.fake_service,
-                                                         self.fake_runlevel)
-        self.assertTrue(val)
-
-    def test_DisableService(self):
-        code, output = self.datamodel.disable_service(self.fake_service,
-                                                      self.fake_runlevel)
-        # Subprocess will return > 0 if this fails
-        self.assertEqual(code, 0)
-        # Check the status of this service now.  Should be disabled
-        val = self.datamodel.get_service_runlevel_status(self.fake_service,
-                                                         self.fake_runlevel)
-        self.assertEqual(val, False)
-
-    def test_InvalidRunlevel_enable(self):
-        self.assertRaises(AssertionError,
-                          self.datamodel.enable_service,
-                          self.fake_service, 0)
-        self.assertRaises(AssertionError,
-                          self.datamodel.enable_service,
-            self.fake_service, 6)
-
-    def test_InvalidService_enable(self):
-        """ Try to enable an unknown service."""
-        return self.assertRaises(AssertionError,
-                          self.datamodel.enable_service,
-            "foo", 2)
-
-    def test_InvalidRunlevel_disable(self):
-        """ Try to disable services for an invalid runlevel """
-        self.assertRaises(AssertionError,
-                          self.datamodel.disable_service,
-            self.fake_service, 0)
-        self.assertRaises(AssertionError,
-                          self.datamodel.disable_service,
-            self.fake_service, 6)
-        return
-
-    def test_InvalidService_disable(self):
-        """ Try to disable an invalid service """
-        return self.assertRaises(AssertionError,
-                                 self.datamodel.disable_service,
-            "foo", 2)
-        
-
-if __name__ == '__main__':
-    assert os.geteuid() == 0, "You must be root to run tests on system services"
-    unittest.main()

File src/tests/test_SKEL.py

-#
-#    VASM is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License v3 as published by
-#    the Free Software Foundation.
-#
-#    VASM is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License
-#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
-
-import os
-import sys
-vasmdir = os.path.join(os.path.dirname(
-    os.path.dirname(os.path.abspath(__file__))), 'vasm')
-if not vasmdir in sys.path: sys.path.append(vasmdir)
-from backend import USERADMIN, SKEL
-import unittest
-
-__author__ = "Moises Henriquez"
-__author_email__ = "moc.liamg@xnl.E0M"[::-1]
-
-
-class TestSkel(unittest.TestCase):
-    def setUp(self):
-        # create a fake user account.
-        self.usermodel = USERADMIN.UserModel()
-        self._fake_user = USERADMIN.User(login='fidencio', new=True)
-        if self.usermodel.hasUser(self._fake_user.login):
-            self.usermodel.deleteUser(self._fake_user.login)
-        self._fake_user.realname = 'Fidencio Hdz'
-        self._fake_user.groups = ['sys', 'adm', 'slocate', 'netdev', 'power']
-        self._fake_user.password = 'secrepassword'
-        self.usermodel.addUser(self._fake_user)
-        
-        self.assertTrue(self.usermodel.hasUser('fidencio'))
-        self.SkelModel = SKEL.UserSkel('fidencio')
-        self.addCleanup(self._custom_cleanup)
-
-    def test_ResetInvalidSetting(self):
-        """ Make sure we raise an exception when we try to reset something that doesn't exist."""
-        return self.assertRaises(AssertionError,
-                                 self.SkelModel.reset_settings,'foo')
-
-    def test_ResetSettingsDir(self):
-        """ Test resetting a directory of settings """
-        d = None
-        for f in self.SkelModel.list_resettable_settings():
-            if os.path.isdir(os.path.join('/etc/skel', f)):
-                d = f
-                break
-        return self.assertTrue(self.SkelModel.reset_settings([d]))
-
-    def test_ResetSettingsFile(self):
-        """ Test resetting a settings file """
-        # get a file first
-        f = None
-        for s in self.SkelModel.list_resettable_settings():
-            if not os.path.isdir(os.path.join('/etc/skel', s)):
-                f = s
-                break
-        return self.assertTrue(self.SkelModel.reset_settings([f]))
-
-    def _custom_cleanup(self):
-        if self.usermodel.hasUser(self._fake_user.login):
-            self.usermodel.deleteUser(self._fake_user.login)
-
-    def tearDown(self):
-        # delete the created user
-        if self.usermodel.hasUser(self._fake_user.login):
-            self.usermodel.deleteUser(self._fake_user.login)
-        super(TestSkel, self).tearDown()
-
-
-if __name__ == '__main__':
-    assert os.geteuid != 0, "You must be root to perform SKEL tests because these are jailed tests."
-    unittest.main()

File src/tests/test_USERMANAGE.py

-#!/usr/bin/env python
-
-#    This file is part of VASM.
-#
-#    VASM is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License v3 as published by
-#    the Free Software Foundation.
-#
-#    VASM is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License
-#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
-
-import os
-import sys
-import unittest
-vasmdir = os.path.join(os.path.dirname(
-    os.path.dirname(os.path.abspath(__file__))), 'vasm')
-if not vasmdir in sys.path: sys.path.append(vasmdir)
-from backend import USERADMIN
-
-class Test(unittest.TestCase):
-    """ Subclass of jailedtests to test how we do when creating accounts """
-
-    @classmethod
-    def setUpClass(cls):
-        pass
-
-    @classmethod
-    def tearDownClass(cls):
-        pass
-
-    def tearDown(self):
-        if self.usermodel.hasUser(self.user.login):
-            self.usermodel.deleteUser(self.user.login)
-    
-    def setUp(self):
-        self.usermodel = USERADMIN.UserModel()
-        # create a dummy account
-        self.user = USERADMIN.User('fidencio', new=True)
-        self.user.fullname = 'Fidencio Hdz'
-        self.user.groups = ['sys', 'adm', 'slocate', 'power']
-        self.user.password = 'supersecretpassword'
-        self.addCleanup(self._cleanup)
-
-    def _cleanup(self):
-        if self.usermodel.hasUser(self.user.login):
-            self.usermodel.deleteUser(self.user.login)
-        return
-
-    def test_Invalid_user_object(self):
-        # Make sure we raise an exception when invalid user argument is given to addUser
-        self.assertRaises(AssertionError,
-                          self.usermodel.addUser, self.user.login)
-        return
-
-    def test_missing_login_attribute(self):
-        user = self.user
-        user.login = None
-        return self.assertRaises(USERADMIN.EmptyAttributeError,
-                                 self.usermodel.addUser, user)
-
-    def test_missing_passsword_attribute(self):
-        user = self.user
-        user.password = None
-        return self.assertRaises(USERADMIN.EmptyAttributeError,
-                                 self.usermodel.addUser, user)
-
-    def test_short_password_attribute(self):
-        user = self.user
-        user.password = 'foo'
-        return self.assertRaises(AssertionError,
-                                 self.usermodel.addUser, user)
-
-    def test_missing_groups_attribute(self):
-        user = self.user
-        user.groups = None
-        return self.assertRaises(USERADMIN.EmptyAttributeError,
-                                 self.usermodel.addUser, user)
-
-    def test_wrong_groups_attribute(self):
-        user = self.user
-        user.groups = "foo,bar"
-        return self.assertRaises(USERADMIN.EmptyAttributeError,
-                                 self.usermodel.addUser, user)
-    
-    def test_Delete_Nonexistant_User(self):
-        # Try to delete a user account that doesn't exist.  This should except.
-        return self.assertRaises(AssertionError,
-                                 self.usermodel.deleteUser, self.user)
-
-    def test_MakeUser(self):
-        # Create a new user account
-        self.usermodel.addUser(self.user)
-        self.assertTrue(self.usermodel.hasUser(self.user.login)), "User account was not successfully created."
-        # test to make sure the attributes of the created account match what we wanted.
-        return
-
-    def test_Add_Existing_user(self):
-        # Try to add a user that already exists.  This should except
-        self.test_MakeUser()
-        return self.assertRaises(AssertionError,
-                          self.usermodel.addUser, self.user)
-
-    def test_user_attributes(self):
-        # Test the user attributes, with the resulting user account
-        self.test_MakeUser()
-        euser = self.usermodel.getUser(self.user.login)
-        self.assertEqual(self.user.login, euser.login), "User login mismatch."
-        self.assertTrue(euser.uid > 1000), "User ID is in invalid range."
-        self.assertEqual(self.user.groups, euser.groups), "User groups mismatch."
-        self.assertEqual(self.user.fullname, euser.fullname), "User full name mismatch."
-    
-    def test_DeleteUser(self):
-        """ Testing user deletion capabilities ... """
-        self.test_MakeUser()
-        # make sure the user is created
-        self.assertTrue, self.usermodel.hasUser(self.user.login)
-        # delete the account
-        self.usermodel.deleteUser(self.user.login)
-        self.assertTrue(self.usermodel.hasUser(self.user.login) is False), "User account was not deleted."
-
-
-if __name__ =='__main__':
-    assert os.geteuid() == 0, "You must be root to run jailed tests."
-    unittest.main()

File src/tests/test_bootmode.py

+#!/usr/bin/env python
+
+#    This file is part of VASM.
+#
+#    VASM is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License v3 as published by
+#    the Free Software Foundation.
+#
+#    VASM is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
+
+__author__ = "Moises Henriquez"
+__author_email__ = "moc.liamg@xnl.E0M"[::-1]
+
+
+import os
+import sys
+import shutil
+import unittest
+vasmdir = os.path.join(os.path.dirname(
+    os.path.dirname(os.path.abspath(__file__))), 'vasm')
+if not vasmdir in sys.path: sys.path.append(vasmdir)
+from backend import bootmode
+
+
+
+class BootModeTest(unittest.TestCase):
+    def setUp(self):
+        self.file = "/tmp/inittab"
+        shutil.copy2("/etc/inittab", "/tmp/inittab")
+        self.model = bootmode.InitTab(self.file)
+        self._original_data = []
+        with open(self.file) as file:
+            for line in file:
+                self._original_data.append(line)
+        
+    
+    def tearDown(self):
+        # remove the temp file
+        os.remove("/tmp/inittab")
+    
+    def test_methods(self):
+        """ Test to make sure the class has the right methods """
+        self.assertTrue(callable(self.model.getMode))
+        self.assertTrue(callable(self.model.setMode))
+
+    def test_getMode(self):
+        mode = self.model.getMode()
+        self.assertTrue(type(mode) == int)
+    
+    def test_setMode(self):
+        # copy the file to tmp
+        mode = 3
+        self.model.setMode(mode)
+        # make sure when we read it, it comes back the same as it went in
+        result = self.model.getMode()
+        self.assertEqual(mode, result)
+        
+        # Check that this method raises an exception if fed the wrong values
+        self.assertRaises(AssertionError, self.model.setMode, 0)
+        self.assertRaises(AssertionError, self.model.setMode, 6)
+
+if __name__ == "__main__":
+    unittest.main()

File src/tests/test_dateset.py

+
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+
+#    This file is part of VASM.
+#
+#    VASM is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License v3 as published by
+#    the Free Software Foundation.
+#
+#    VASM is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
+
+
+import unittest
+import os
+import sys
+vasmdir = os.path.join(os.path.dirname(
+    os.path.dirname(os.path.abspath(__file__))), 'vasm')
+if not vasmdir in sys.path: sys.path.append(vasmdir)
+from backend import dateset
+
+class ClockTest(unittest.TestCase):
+    """ Test the functionality to set the hardware clock """
+    def setUp(self):
+        self.clock = dateset.HWClock()
+        super(ClockTest, self).setUp()
+        self.dummyvalue = "localtime"
+
+    def test_setClock(self):
+        # This will except if something goes wrong
+        self.clock.set_value(self.dummyvalue)
+        gotval = self.clock.get_value()
+        return self.assertEqual(gotval, self.dummyvalue)
+
+    def test_invalid_values(self):
+        self.assertRaises(AssertionError,
+                          self.clock.set_value, "foo")
+        self.assertRaises(AssertionError,
+                          self.clock.set_value, "")
+        
+
+class TimeZoneTest(unittest.TestCase):
+    """ Test timezone setting and getting """
+    def setUp(self):
+        self.zone = dateset.TimeZone()
+        super(TimeZoneTest, self).setUp()
+        self.zonesbase = "/usr/share/zoneinfo/"
+        self.tz = "US/Eastern"
+
+    def test_setEmtyZone(self):
+        self.assertRaises(AssertionError,
+                          self.zone.set_zone, "")
+        return self.assertRaises(AssertionError,
+                                 self.zone.set_zone, None)
+
+    def test_setzone(self):
+        ret = self.zone.set_zone(self.tz)
+        return self.assertTrue(ret)
+
+    def test_getzone(self):
+        # set the zone.
+        self.assertTrue(self.zone.set_zone(self.tz))
+        zone = self.zone.get_zone()
+        return self.assertEqual(zone, self.tz)
+
+    def test_verify_with_filesystem(self):
+        # we must set it again
+        self.assertTrue(self.zone.set_zone(self.tz))
+        rlink = os.readlink("/etc/localtime-copied-from")
+        return self.assertEqual(rlink, os.path.join(self.zonesbase, self.tz))
+
+
+class DateTimeTest(unittest.TestCase):
+    """ Test the functionality to set and get the system time """
+
+    def setUp(self):
+        super(DateTimeTest, self).setUp()
+        self.date_time = dateset.DateTime()
+
+        # save current time for restoring it later
+        self.now = self.date_time._date_time
+        self.date = self.now.year, self.now.month, self.now.day
+        self.time = self.now.hour, self.now.minute, self.now.second
+
+    def tearDown(self):
+        super(DateTimeTest, self).tearDown()
+        dt = self.date_time
+        dt.year, dt.month, dt.day = self.date
+        dt.hour, dt.minute, dt.second = self.time
+        self.date_time.set_date_and_time()
+
+    def testSetDate(self):
+
+        # test day and month < 10
+        self.date_time.year += 1
+        self.date_time.month = 2
+        self.date_time.day = 2
+        self.date_time.set_date()
+        current_date = dateset.DateTime()
+        self.assertEqual(current_date.year, self.date[0] + 1)
+        self.assertEqual(self.date_time.year, current_date.year)
+        self.assertEqual(self.date_time.month, current_date.month)
+        self.assertEqual(self.date_time.day, current_date.day)
+
+        # test day and month > 10
+        self.date_time.month = 12
+        self.date_time.day = 24
+        self.date_time.set_date()
+        current_date = dateset.DateTime()
+        self.assertEqual(current_date.year, self.date[0] + 1)
+        self.assertEqual(self.date_time.year, current_date.year)
+        self.assertEqual(self.date_time.month, current_date.month)
+        self.assertEqual(self.date_time.day, current_date.day)
+
+    def testSetTime(self):
+ 
+        self.date_time.hour += 1
+        self.date_time.minute += 1
+        self.date_time.second = 0
+        self.date_time.set_time()
+        current_time = dateset.DateTime()
+        self.assertEqual(current_time.hour, self.time[0] + 1)
+        self.assertEqual(current_time.minute, self.time[1] + 1)
+        self.assertEqual(self.date_time.hour, current_time.hour)
+        self.assertEqual(self.date_time.minute, current_time.minute)
+        self.assertAlmostEqual(self.date_time.second, current_time.second)
+
+
+if __name__ == "__main__":
+    assert os.getuid() == 0, "You need to be root for running DateTime tests"
+    unittest.main()

File src/tests/test_fstab.py

+#!/usr/bin/env python
+
+#    This file is part of VASM.
+#
+#    VASM is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License v3 as published by
+#    the Free Software Foundation.
+#
+#    VASM is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
+
+__author__ = "Moises Henriquez"
+__author_email__ = "moc.liamg@xnl.E0M"[::-1]
+
+import unittest
+import os
+import sys
+vasmdir = os.path.join(os.path.dirname(
+    os.path.dirname(os.path.abspath(__file__))), 'vasm')
+if not vasmdir in sys.path: sys.path.append(vasmdir)
+import unittest
+from backend import fstab
+from shutil import copy2
+
+class FstabTest(unittest.TestCase):
+    def setUp(self):
+        # create a copy of /etc/fstab so we can play with it
+        self.datapath = '/tmp/test_fstab'
+        copy2('/etc/fstab', self.datapath)
+        self.datamodel = fstab.FstabModel(self.datapath)
+        self.fake_entry = fstab.FstabEntry()
+        self.fake_entry.device = "/dev/sdz1"
+        self.fake_entry.mountpoint = "fake_mount_point"
+        self.fake_entry.filesystem = "ext2"
+        self.fake_entry.options = "defaults 1 0"
+        return
+
+    def test_check_for_entry(self):
+        # Check if an entry exists
+        # We have not yet added fake_entry, so this should return False
+        self.assertTrue(self.datamodel.hasEntry(self.fake_entry.device) is False)
+
+    def test_add_entry(self):
+        # Check if we can add an entry
+        self.datamodel.addEntry(self.fake_entry)
+        # now check if we have the entry there
+        self.assertTrue(self.datamodel.hasEntry(self.fake_entry.device))
+
+    def test_remove_entry(self):
+        # Check if we can remove an entry
+        self.datamodel.addEntry(self.fake_entry)
+        self.assertTrue(self.datamodel.hasEntry(self.fake_entry.device))
+        self.datamodel.removeEntry(self.fake_entry.device)
+        self.assertTrue(self.datamodel.hasEntry(self.fake_entry.device) is False)
+
+    def test_invalid_entry_argument(self):
+        # Make sure it raises an exception if we give it a string
+        self.assertRaises(AssertionError,
+                          self.datamodel.addEntry, 'foo')
+
+    def test_incomplete_entry_attributes(self):
+        # make sure we raise an exception when the attributes of the entry are not complete
+        entry = fstab.FstabEntry() # empty entry
+        self.assertRaises(AssertionError,
+                          self.datamodel.addEntry, entry)
+        
+    def tearDown(self):
+        """ Remove the file when we're done """
+        return os.remove(self.datapath)
+
+
+if __name__ == "__main__":
+    assert os.geteuid() == 0, "You must be root to run tests on /etc/fstab """
+    unittest.main()
+

File src/tests/test_loginmanagers.py

+#!/usr/bin/env python
+
+#    This file is part of VASM.
+#
+#    VASM is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License v3 as published by
+#    the Free Software Foundation.
+#
+#    VASM is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
+
+__author__ = "Moises Henriquez"
+__author_email__ = "moc.liamg@xnl.E0M"[::-1]
+
+import sys
+import os
+import shutil
+import unittest
+vasmdir = os.path.join(os.path.dirname(
+    os.path.dirname(os.path.abspath(__file__))), 'vasm')
+if not vasmdir in sys.path: sys.path.append(vasmdir)
+from backend import loginmanagers as gestores
+
+
+class BootModeTest(unittest.TestCase):
+    def setUp(self):
+        self.file = "/tmp/rc.X"
+        shutil.copy2("/etc/rc.d/rc.X", "/tmp/rc.X")
+        self.model = gestores.LoginManagers(specfile=self.file)
+    
+    def tearDown(self):
+        # remove the temp file
+        os.remove(self.file)
+        
+    def test_getCurrent(self):
+        gestor = self.model.get_current()
+        self.assertTrue(type(gestor) == str)
+    
+    def test_setMode(self):
+        # copy the file to tmp
+        manager = "FOO"
+        res = self.model.set_manager("FOO")
+        read_man = self.model.get_current()
+        self.assertEqual(read_man, manager)
+    
+    def test_roundTest(self):
+        man = "BAR"
+        # set the mode
+        res = self.model.set_manager(man)
+        # read it to make sure it comes back the same
+        read = self.model.get_current()
+        self.assertEqual(read, man)
+    
+    def test_managers(self):
+        res = self.model.list_existing()
+        self.assertTrue(len(res) > 0)
+    
+    def test_descriptions(self):
+        manager = self.model.list_existing()[0].lower()
+        res = self.model._describe_manager(manager)
+        self.assertTrue(type(res), str)
+        
+        
+        
+        
+
+if __name__ == "__main__":
+    unittest.main()

File src/tests/test_networking.py

+#!/usr/bin/env python
+
+#    This file is part of VASM.
+#
+#    VASM is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License v3 as published by
+#    the Free Software Foundation.
+#
+#    VASM is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
+
+""" test_networking.py
+Test suite for the networking module"""
+__author__ = "Moises Henriquez"
+__author_email__ = "moc.liamg@xnl.E0M"[::-1]
+
+import os
+import sys
+vasmdir = os.path.join(os.path.dirname(
+    os.path.dirname(os.path.abspath(__file__))), 'vasm')
+if not vasmdir in sys.path: sys.path.append(vasmdir)
+import unittest
+from backend import networking
+
+class NetworkingTests(unittest.TestCase):
+    def setUp(self):
+        self.addCleanup(self._cleanup)
+        self.assertTrue(hasattr(networking, 'NetConfModel'))
+        self.hostname = 'foo.host.vnet'
+        self.host_file = '/tmp/hostnamefile'
+        self.model = networking.NetConfModel(host_file=self.host_file)
+    
+    def tearDown(self):
+        return self._cleanup()
+    
+    def _cleanup(self):
+        if os.path.exists(self.host_file):
+            os.remove(self.host_file)
+    
+    def testCreateNic(self):
+        # Create a fake nic object
+        mynic = networking.Nic('wlan10')
+        # The config file should not exist
+        self.assertTrue(not os.path.exists(mynic.inet.fpath))
+        self.assertEqual(mynic.inet.config['DEVICE'], mynic.devname)
+        # Disabling this nic should raise an exception because the
+        # config file does not exist
+        self.assertRaises(AssertionError, mynic.disable)
+    
+    def testHostnameWriteRead(self):
+        # writing an empty hostname raise exception
+        self.model.hostname = ""
+        self.assertRaises(AssertionError, self.model.set_hostname)
+        self.model.hostname = None
+        self.assertRaises(AssertionError, self.model.set_hostname)
+        # Passing an argument to set_hostname will raise TypeError
+        self.assertRaises(TypeError, self.model.set_hostname, 'foo')
+        
+        # write the hostname
+        self.model.hostname = self.hostname
+        self.model.set_hostname()
+        readname = self.model.get_hostname()
+        return self.assertEqual(readname, self.hostname)
+
+
+if __name__ == '__main__':
+    assert os.geteuid() == 0, "Only root is allowed to run these tests."""
+    unittest.main()

File src/tests/test_services.py

+#!/usr/bin/env python
+
+#    This file is part of VASM.
+#
+#    VASM is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License v3 as published by
+#    the Free Software Foundation.
+#
+#    VASM is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
+
+__author__ = "Moises Henriquez"
+__author_email__ = "moc.liamg@xnl.E0M"[::-1]
+
+import unittest
+import os
+import sys
+vasmdir = os.path.join(os.path.dirname(
+    os.path.dirname(os.path.abspath(__file__))), 'vasm')
+if not vasmdir in sys.path: sys.path.append(vasmdir)
+from backend import services as services
+
+class ServicesTests(unittest.TestCase):
+    def setUp(self):
+        self.datamodel = services.ServiceModel()
+        self.fake_service = self.datamodel.list_all_services()[0]
+        self.fake_runlevel = 4
+
+    def test_EnableService(self):
+        code, output = self.datamodel.enable_service(self.fake_service,
+                                                     self.fake_runlevel)
+        # subprocess will return > 0 if this fails
+        self.assertEqual(code, 0)
+        # this return True when service is enabled, False otherwise
+        # should be enabled now
+        val = self.datamodel.get_service_runlevel_status(self.fake_service,
+                                                         self.fake_runlevel)
+        self.assertTrue(val)
+
+    def test_DisableService(self):
+        code, output = self.datamodel.disable_service(self.fake_service,
+                                                      self.fake_runlevel)
+        # Subprocess will return > 0 if this fails
+        self.assertEqual(code, 0)
+        # Check the status of this service now.  Should be disabled
+        val = self.datamodel.get_service_runlevel_status(self.fake_service,
+                                                         self.fake_runlevel)
+        self.assertEqual(val, False)
+
+    def test_InvalidRunlevel_enable(self):
+        self.assertRaises(AssertionError,
+                          self.datamodel.enable_service,
+                          self.fake_service, 0)
+        self.assertRaises(AssertionError,
+                          self.datamodel.enable_service,
+            self.fake_service, 6)
+
+    def test_InvalidService_enable(self):
+        """ Try to enable an unknown service."""
+        return self.assertRaises(AssertionError,
+                          self.datamodel.enable_service,
+            "foo", 2)
+
+    def test_InvalidRunlevel_disable(self):
+        """ Try to disable services for an invalid runlevel """
+        self.assertRaises(AssertionError,
+                          self.datamodel.disable_service,
+            self.fake_service, 0)
+        self.assertRaises(AssertionError,
+                          self.datamodel.disable_service,
+            self.fake_service, 6)
+        return
+
+    def test_InvalidService_disable(self):
+        """ Try to disable an invalid service """
+        return self.assertRaises(AssertionError,
+                                 self.datamodel.disable_service,
+            "foo", 2)
+        
+
+if __name__ == '__main__':
+    assert os.geteuid() == 0, "You must be root to run tests on system services"
+    unittest.main()

File src/tests/test_skel.py

+#
+#    VASM is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License v3 as published by
+#    the Free Software Foundation.
+#
+#    VASM is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import sys
+vasmdir = os.path.join(os.path.dirname(
+    os.path.dirname(os.path.abspath(__file__))), 'vasm')
+if not vasmdir in sys.path: sys.path.append(vasmdir)
+from backend import useradmin, skel
+import unittest
+
+__author__ = "Moises Henriquez"
+__author_email__ = "moc.liamg@xnl.E0M"[::-1]
+
+
+class TestSkel(unittest.TestCase):
+    def setUp(self):
+        # create a fake user account.
+        self.usermodel = useradmin.UserModel()
+        self._fake_user = useradmin.User(login='fidencio', new=True)
+        if self.usermodel.hasUser(self._fake_user.login):
+            self.usermodel.deleteUser(self._fake_user.login)
+        self._fake_user.realname = 'Fidencio Hdz'
+        self._fake_user.groups = ['sys', 'adm', 'slocate', 'netdev', 'power']
+        self._fake_user.password = 'secrepassword'
+        self.usermodel.addUser(self._fake_user)
+        
+        self.assertTrue(self.usermodel.hasUser('fidencio'))
+        self.SkelModel = skel.UserSkel('fidencio')
+        self.addCleanup(self._custom_cleanup)
+
+    def test_ResetInvalidSetting(self):
+        """ Make sure we raise an exception when we try to reset something that doesn't exist."""
+        return self.assertRaises(AssertionError,
+                                 self.SkelModel.reset_settings,'foo')
+
+    def test_ResetSettingsDir(self):
+        """ Test resetting a directory of settings """
+        d = None
+        for f in self.SkelModel.list_resettable_settings():
+            if os.path.isdir(os.path.join('/etc/skel', f)):
+                d = f
+                break
+        return self.assertTrue(self.SkelModel.reset_settings([d]))
+
+    def test_ResetSettingsFile(self):
+        """ Test resetting a settings file """
+        # get a file first
+        f = None
+        for s in self.SkelModel.list_resettable_settings():
+            if not os.path.isdir(os.path.join('/etc/skel', s)):
+                f = s
+                break
+        return self.assertTrue(self.SkelModel.reset_settings([f]))
+
+    def _custom_cleanup(self):
+        if self.usermodel.hasUser(self._fake_user.login):
+            self.usermodel.deleteUser(self._fake_user.login)
+
+    def tearDown(self):
+        # delete the created user
+        if self.usermodel.hasUser(self._fake_user.login):
+            self.usermodel.deleteUser(self._fake_user.login)
+        super(TestSkel, self).tearDown()
+
+
+if __name__ == '__main__':
+    assert os.geteuid != 0, "You must be root to perform skel tests because these are jailed tests."
+    unittest.main()

File src/tests/test_usermanage.py

+#!/usr/bin/env python
+
+#    This file is part of VASM.
+#
+#    VASM is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License v3 as published by
+#    the Free Software Foundation.
+#
+#    VASM is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with VASM.  If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import sys
+import unittest
+vasmdir = os.path.join(os.path.dirname(
+    os.path.dirname(os.path.abspath(__file__))), 'vasm')
+if not vasmdir in sys.path: sys.path.append(vasmdir)
+from backend import useradmin
+
+class Test(unittest.TestCase):
+    """ Subclass of jailedtests to test how we do when creating accounts """
+
+    @classmethod
+    def setUpClass(cls):
+        pass
+
+    @classmethod
+    def tearDownClass(cls):
+        pass
+
+    def tearDown(self):
+        if self.usermodel.hasUser(self.user.login):
+            self.usermodel.deleteUser(self.user.login)
+    
+    def setUp(self):
+        self.usermodel = useradmin.UserModel()
+        # create a dummy account
+        self.user = useradmin.User('fidencio', new=True)
+        self.user.fullname = 'Fidencio Hdz'
+        self.user.groups = ['sys', 'adm', 'slocate', 'power']
+        self.user.password = 'supersecretpassword'
+        self.addCleanup(self._cleanup)
+
+    def _cleanup(self):
+        if self.usermodel.hasUser(self.user.login):
+            self.usermodel.deleteUser(self.user.login)
+        return
+
+    def test_Invalid_user_object(self):
+        # Make sure we raise an exception when invalid user argument is given to addUser
+        self.assertRaises(AssertionError,
+                          self.usermodel.addUser, self.user.login)
+        return
+
+    def test_missing_login_attribute(self):
+        user = self.user
+        user.login = None
+        return self.assertRaises(useradmin.EmptyAttributeError,
+                                 self.usermodel.addUser, user)
+
+    def test_missing_passsword_attribute(self):
+        user = self.user
+        user.password = None
+        return self.assertRaises(useradmin.EmptyAttributeError,
+                                 self.usermodel.addUser, user)
+
+    def test_short_password_attribute(self):
+        user = self.user
+        user.password = 'foo'
+        return self.assertRaises(AssertionError,
+                                 self.usermodel.addUser, user)
+
+    def test_missing_groups_attribute(self):
+        user = self.user
+        user.groups = None
+        return self.assertRaises(useradmin.EmptyAttributeError,
+                                 self.usermodel.addUser, user)
+
+    def test_wrong_groups_attribute(self):
+        user = self.user
+        user.groups = "foo,bar"
+        return self.assertRaises(useradmin.EmptyAttributeError,
+                                 self.usermodel.addUser, user)
+    
+    def test_Delete_Nonexistant_User(self):
+        # Try to delete a user account that doesn't exist.  This should except.
+        return self.assertRaises(AssertionError,
+                                 self.usermodel.deleteUser, self.user)
+
+    def test_MakeUser(self):
+        # Create a new user account
+        self.usermodel.addUser(self.user)
+        self.assertTrue(self.usermodel.hasUser(self.user.login)), "User account was not successfully created."
+        # test to make sure the attributes of the created account match what we wanted.
+        return
+
+    def test_Add_Existing_user(self):
+        # Try to add a user that already exists.  This should except
+        self.test_MakeUser()
+        return self.assertRaises(AssertionError,
+                          self.usermodel.addUser, self.user)
+
+    def test_user_attributes(self):
+        # Test the user attributes, with the resulting user account
+        self.test_MakeUser()
+        euser = self.usermodel.getUser(self.user.login)
+        self.assertEqual(self.user.login, euser.login), "User login mismatch."
+        self.assertTrue(euser.uid > 1000), "User ID is in invalid range."
+        self.assertEqual(self.user.groups, euser.groups), "User groups mismatch."
+        self.assertEqual(self.user.fullname, euser.fullname), "User full name mismatch."
+    
+    def test_DeleteUser(self):
+        """ Testing user deletion capabilities ... """
+        self.test_MakeUser()
+        # make sure the user is created
+        self.assertTrue, self.usermodel.hasUser(self.user.login)
+        # delete the account
+        self.usermodel.deleteUser(self.user.login)
+        self.assertTrue(self.usermodel.hasUser(self.user.login) is False), "User account was not deleted."
+
+
+if __name__ =='__main__':
+    assert os.geteuid() == 0, "You must be root to run jailed tests."
+    unittest.main()

File src/vasm/backend/networking.py

     
     def _get_live_data(self):
         """ Returns a dictionary of the current information on this nic """
+        # privide nothing if the device does not exist
+        if not self.devname in netinfo.list_devs():
+            ret = {'IPADDR': None, 
+                   'NETMASK': None, 
+                   'BROADCAST': None}
+            return ret
         ldata = netinfo.get_routes(self.devname)
         data = {
             'IPADDR': netinfo.get_ip(self.devname),

File src/vasm/ui/gtk2/support/widgets.py

 class DLabel(gtk.Label):
     """ gtk label that resizes and reflows text dinamically when the
     parent window is resized"""
-    #__gtype_name__ = "DLabel"
     def __init__(self, markup=None):
         gtk.Label.__init__(self)
         self.set_property('use-markup', True)