Пример #1
0
    def test_add_new_ide_controller_helper(self, randint_mock):
        '''
        Tests that creating a new controller, ensuring that it will generate a controller key
        if one is not provided
        '''
        controller_label = 'Some label'
        bus_number = 1
        spec = vmware._add_new_ide_controller_helper(controller_label, None, bus_number)
        self.assertEqual(spec.device.key, randint_mock.return_value)

        spec = vmware._add_new_ide_controller_helper(controller_label, 200, bus_number)
        self.assertEqual(spec.device.key, 200)

        self.assertEqual(spec.device.busNumber, bus_number)
        self.assertEqual(spec.device.deviceInfo.label, controller_label)
        self.assertEqual(spec.device.deviceInfo.summary, controller_label)
Пример #2
0
    def test_add_new_ide_controller_helper(self, randint_mock):
        '''
        Tests that creating a new controller, ensuring that it will generate a controller key
        if one is not provided
        '''
        controller_label = 'Some label'
        bus_number = 1
        spec = vmware._add_new_ide_controller_helper(controller_label, None, bus_number)
        self.assertEqual(spec.device.key, randint_mock.return_value)

        spec = vmware._add_new_ide_controller_helper(controller_label, 200, bus_number)
        self.assertEqual(spec.device.key, 200)

        self.assertEqual(spec.device.busNumber, bus_number)
        self.assertEqual(spec.device.deviceInfo.label, controller_label)
        self.assertEqual(spec.device.deviceInfo.summary, controller_label)
Пример #3
0
    def test_add_new_ide_controller_helper(self):
        """
        Tests that creating a new controller, ensuring that it will generate a controller key
        if one is not provided
        """
        with patch("salt.cloud.clouds.vmware.randint",
                   return_value=101) as randint_mock:
            controller_label = "Some label"
            bus_number = 1
            spec = vmware._add_new_ide_controller_helper(
                controller_label, None, bus_number)
            self.assertEqual(spec.device.key, randint_mock.return_value)

            spec = vmware._add_new_ide_controller_helper(
                controller_label, 200, bus_number)
            self.assertEqual(spec.device.key, 200)

            self.assertEqual(spec.device.busNumber, bus_number)
            self.assertEqual(spec.device.deviceInfo.label, controller_label)
            self.assertEqual(spec.device.deviceInfo.summary, controller_label)