def test_type_is_unsupported(self):
        """Assert ``SkipTest`` is raised if the given unit type is unsupported.

        Also assert :func:`pulp_smash.config.get_config` is called, as we do
        not provide a :class:`pulp_smash.config.ServerConfig` argument.
        """
        with mock.patch.object(config, 'get_config') as get_config:
            with mock.patch.object(utils, 'get_unit_type_ids') as get_u_t_ids:
                get_u_t_ids.return_value = set()
                with self.assertRaises(unittest.SkipTest):
                    utils.skip_if_type_is_unsupported(self.unit_type_id)
        self.assertEqual(get_config.call_count, 1)
Beispiel #2
0
    def test_type_is_unsupported(self):
        """Assert ``SkipTest`` is raised if the given unit type is unsupported.

        Also assert :func:`pulp_smash.config.get_config` is called, as we do
        not provide a :class:`pulp_smash.config.ServerConfig` argument.
        """
        with mock.patch.object(config, 'get_config') as get_config:
            with mock.patch.object(utils, 'get_unit_type_ids') as get_u_t_ids:
                get_u_t_ids.return_value = set()
                with self.assertRaises(unittest2.SkipTest):
                    utils.skip_if_type_is_unsupported(self.unit_type_id)
        self.assertEqual(get_config.call_count, 1)
Beispiel #3
0
    def test_type_is_supported(self):
        """Assert nothing happens if the given unit type is supported.

        Also assert :func:`pulp_smash.config.get_config` is not called, as we
        provide a :class:`pulp_smash.config.ServerConfig` argument.
        """
        with mock.patch.object(config, 'get_config') as get_config:
            with mock.patch.object(utils, 'get_unit_type_ids') as get_u_t_ids:
                get_u_t_ids.return_value = {self.unit_type_id}
                self.assertIsNone(utils.skip_if_type_is_unsupported(
                    self.unit_type_id,
                    mock.Mock(),  # a ServerConfig object
                ))
        self.assertEqual(get_config.call_count, 0)
    def test_type_is_supported(self):
        """Assert nothing happens if the given unit type is supported.

        Also assert :func:`pulp_smash.config.get_config` is not called, as we
        provide a :class:`pulp_smash.config.ServerConfig` argument.
        """
        with mock.patch.object(config, 'get_config') as get_config:
            with mock.patch.object(utils, 'get_unit_type_ids') as get_u_t_ids:
                get_u_t_ids.return_value = {self.unit_type_id}
                self.assertIsNone(
                    utils.skip_if_type_is_unsupported(
                        self.unit_type_id,
                        mock.Mock(),  # a ServerConfig object
                    ))
        self.assertEqual(get_config.call_count, 0)
Beispiel #5
0
def set_up_module():
    """Skip tests if the RPM plugin is not installed.

    See :mod:`pulp_smash.tests` for more information.
    """
    utils.skip_if_type_is_unsupported('rpm')
def set_up_module():
    """Skip tests if the Docker plugin is not installed.

    See :mod:`pulp_smash.tests` for more information.
    """
    utils.skip_if_type_is_unsupported('docker_image')
def set_up_module():
    """Skip tests if the Python plugin is not installed.

    See :mod:`pulp_smash.tests` for more information.
    """
    utils.skip_if_type_is_unsupported('python_package')