コード例 #1
0
    def test_unsupported_platform(self, arch):
        """Test an unsupported platform."""
        self._reset_arch(arch)

        with pytest.raises(SystemError) as cm:
            get_platform()

        assert str(cm.value) == "Could not determine system architecture."
コード例 #2
0
    def unsupported_platform_test(self, arch):
        """Test an unsupported platform."""
        self._reset_arch(arch)

        with self.assertRaises(SystemError) as cm:
            get_platform()

        self.assertEqual(str(cm.exception), "Could not determine system architecture.")
コード例 #3
0
    def unsupported_ppc_test(self, arch):
        """Test an unsupported PPC platform."""
        self._reset_arch(arch)
        arch.is_ppc.return_value = True
        arch.get_ppc_machine.return_value = "INVALID"

        with self.assertRaises(SystemError) as cm:
            get_platform()

        self.assertEqual(str(cm.exception), "Unsupported PPC machine type: INVALID")
コード例 #4
0
    def test_unsupported_ppc(self, arch):
        """Test an unsupported PPC platform."""
        self._reset_arch(arch)
        arch.is_ppc.return_value = True
        arch.get_ppc_machine.return_value = "INVALID"

        with pytest.raises(SystemError) as cm:
            get_platform()

        assert str(cm.value) == "Unsupported PPC machine type: INVALID"
コード例 #5
0
    def _check_platform(self, platform_cls, packages=None, non_linux_format_types=None):
        """Check the detected platform."""
        if packages is None:
            packages = []

        if non_linux_format_types is None:
            non_linux_format_types = []

        platform = get_platform()
        self.assertEqual(platform.__class__, platform_cls)
        self.assertEqual(platform.packages, packages)
        self.assertEqual(platform.non_linux_format_types, non_linux_format_types)
コード例 #6
0
    def _check_platform(self,
                        platform_cls,
                        packages=None,
                        non_linux_format_types=None):
        """Check the detected platform."""
        if packages is None:
            packages = []

        if non_linux_format_types is None:
            non_linux_format_types = []

        platform = get_platform()
        assert platform.__class__ == platform_cls
        assert platform.packages == packages
        assert platform.non_linux_format_types == non_linux_format_types
コード例 #7
0
    def _check_constraints(self, descriptions, constraints, error_message):
        """Check the platform-specific constraints."""
        all_constraints = {
            "device_types": [],
            "format_types": [],
            "mountpoints": [],
            "max_end": None,
            "raid_levels": [],
            "raid_metadata": [],
        }
        all_constraints.update(constraints)

        platform = get_platform()
        self.assertEqual(platform.stage1_descriptions, descriptions)
        self.assertEqual(platform.stage1_constraints, all_constraints)
        self.assertEqual(platform.stage1_suggestion, error_message)
コード例 #8
0
 def _check_partitions(self, *partitions):
     """Check the platform-specific partitions."""
     platform = get_platform()
     self.assertEqual(platform.partitions, list(partitions))
コード例 #9
0
 def _check_partitions(self, *partitions):
     """Check the platform-specific partitions."""
     platform = get_platform()
     assert platform.partitions == list(partitions)