示例#1
0
 def setUp(self):
     parent = interfaceMock(xenrt.interfaces.OSParent)
     parent._osParent_getPowerState = lambda: xenrt.PowerState.up
     self.__linux = LinuxOS(None, parent)
     self.__ssh = Mock()
     self.__linux.waitForSSH = Mock()
     self.__linux.execSSH = self.__ssh
示例#2
0
 def test_instanceInterface(self):
     """Verify the Instance class implements the OSParent interface"""
     # Mock out the methods used by the Instance __init__ so they don't get called
     xenrt.lib.opsys.osFactory = Mock()
     # Crete the Instance, mocking toolstack
     i = xenrt.lib.generic.Instance(interfaceMock(xenrt.interfaces.Toolstack), None, None, None, None)
     # Do the verification
     verifyObject(xenrt.interfaces.OSParent, i)
示例#3
0
 def test_instanceInterface(self):
     """Verify the Instance class implements the OSParent interface"""
     # Mock out the methods used by the Instance __init__ so they don't get called
     xenrt.lib.opsys.osFactory = Mock()
     # Crete the Instance, mocking toolstack
     i = xenrt.lib.generic.Instance(
         interfaceMock(xenrt.interfaces.Toolstack), None, None, None, None)
     # Do the verification
     verifyObject(xenrt.interfaces.OSParent, i)
示例#4
0
    def oslib_supportedInstallMethods(oslib):
        # Instantiate the OS library
        o = oslib.testInit(interfaceMock(xenrt.interfaces.OSParent))

        implementedInterfaces = list(implementedBy(oslib))

        # Determine what interfaces are required based on the supportedInstallMethods attribute
        requiredInterfaces = filter(lambda i: o._allInstallMethods[i] in o.supportedInstallMethods, o._allInstallMethods)

        # Verify the required interfaces are implemented
        for i in requiredInterfaces:
            if not i in implementedInterfaces:
                raise AssertionError("Interface %s not implemented but stated in supportedInstallMethods" % i.__name__)
示例#5
0
    def oslib_supportedInstallMethods(oslib):
        # Instantiate the OS library
        o = oslib.testInit(interfaceMock(xenrt.interfaces.OSParent))

        implementedInterfaces = list(implementedBy(oslib))

        # Determine what interfaces are required based on the supportedInstallMethods attribute
        requiredInterfaces = filter(
            lambda i: o._allInstallMethods[i] in o.supportedInstallMethods,
            o._allInstallMethods)

        # Verify the required interfaces are implemented
        for i in requiredInterfaces:
            if not i in implementedInterfaces:
                raise AssertionError(
                    "Interface %s not implemented but stated in supportedInstallMethods"
                    % i.__name__)
示例#6
0
    def setUp(self):
        # Set up a series of method mocks invlved in assertHealthy
        parent = interfaceMock(xenrt.interfaces.OSParent)
        parent._osParent_getPowerState = lambda: xenrt.PowerState.up
        self.__win = WindowsOS(None, parent)
        self.__randomWord = "SomeRandomStringOrOther"
        generator = FakeRandomStringGenerator(self.__randomWord)
        self.__win.randomStringGenerator = generator

        self.__create = Mock()
        self.__win.createFile = self.__create

        self.__read = Mock(return_value=self.__randomWord)
        self.__win.readFile = self.__read

        self.__remove = Mock()
        self.__win.removeFile = self.__remove
示例#7
0
    def setUp(self):
        # Set up a series of method mocks invlved in assertHealthy
        parent = interfaceMock(xenrt.interfaces.OSParent)
        parent._osParent_getPowerState = lambda: xenrt.PowerState.up
        self.__win = WindowsOS(None, parent)
        self.__randomWord = "SomeRandomStringOrOther"
        generator = FakeRandomStringGenerator(self.__randomWord)
        self.__win.randomStringGenerator = generator

        self.__create = Mock()
        self.__win.createFile = self.__create

        self.__read = Mock(return_value=self.__randomWord)
        self.__win.readFile = self.__read

        self.__remove = Mock()
        self.__win.removeFile = self.__remove
示例#8
0
 def setUp(self):
     self.parent = interfaceMock(xenrt.interfaces.OSParent)
示例#9
0
 def oslib_test(oslib):
     # Instantiate the OS library
     o = oslib.testInit(interfaceMock(xenrt.interfaces.OSParent))
     # Verify all interfaces declared as being implemented
     for i in list(implementedBy(oslib)):
         verifyObject(i, o)
示例#10
0
 def setUp(self):
     self.parent = interfaceMock(xenrt.interfaces.OSParent)
示例#11
0
 def oslib_test(oslib):
     # Instantiate the OS library
     o = oslib.testInit(interfaceMock(xenrt.interfaces.OSParent))
     # Verify all interfaces declared as being implemented
     for i in list(implementedBy(oslib)):
         verifyObject(i, o)