Ejemplo n.º 1
0
    def test_version_manager_set_current_raises_api_error_if_disabled(
            self, mock_get_disabled_versions, mock_get_all):
        # Arrange
        to_disable = _create_mock_object()
        mock_vm = _create_mock_version_manager()

        mock_get_all.return_value = [mock_vm]
        mock_get_disabled_versions.return_value = [str(to_disable.id)]

        # Act + Assert
        with self.assertRaises(exceptions.ApiError):
            version_manager_api.set_current(to_disable)
Ejemplo n.º 2
0
def set_current_version_from_version_manager(version):
    """ Set the current version of a version manager.

    Args:
        version:

    Returns:

    """
    try:
        version_manager_api.set_current(version)
    except Exception as e:
        return HttpResponseBadRequest(str(e), content_type='application/javascript')
Ejemplo n.º 3
0
def set_current(version):
    """Set the current version of the object, then saves it.

    Args:
        version:

    Returns:

    """
    if custom_resource_api.get_all_by_template(version).count() == 0:
        raise exceptions.ApiError(
            "Please set custom resources to template before setting it to current."
        )
    version_manager_api.set_current(version)
Ejemplo n.º 4
0
    def status_update(self, template_object):
        """ Update status to current

        Args:
            template_object:

        Returns:

        """
        return version_manager_api.set_current(template_object)
Ejemplo n.º 5
0
    def status_update(self, template_object):
        """Update status to current

        Args:

            template_object: template_version

        Returns:

            TemplateVersion
        """
        return version_manager_api.set_current(template_object,
                                               request=self.request)