Project

Profile

Help

Issue #825 ยป 0001-Consumer-consumer_group-content-management-should-ha.patch

ipanova@redhat.com, 04/30/2015 04:15 PM

View differences:

docs/dev-guide/integration/rest-api/consumer/content.rst
| :method:`post`
| :path:`/v2/consumers/<consumer_id>/actions/content/install/`
| :permission:`create`
| :permission:`execute`
| :param_list:`post`
* :param:`units,array,array of content units to install`
......
| :method:`post`
| :path:`/v2/consumers/<consumer_id>/actions/content/update/`
| :permission:`create`
| :permission:`execute`
| :param_list:`post`
* :param:`units,array,array of content units to update`
......
| :method:`post`
| :path:`/v2/consumers/<consumer_id>/actions/content/uninstall/`
| :permission:`create`
| :permission:`execute`
| :param_list:`post`
* :param:`units,array,array of content units to uninstall`
docs/dev-guide/integration/rest-api/consumer/group/content.rst
| :method:`post`
| :path:`/v2/consumer_groups/<group_id>/actions/content/install/`
| :permission:`create`
| :permission:`execute`
| :param_list:`post`
* :param:`units,array,array of content units to install`
......
| :method:`post`
| :path:`/v2/consumer_groups/<group_id>/actions/content/update/`
| :permission:`create`
| :permission:`execute`
| :param_list:`post`
* :param:`units,array,array of content units to update`
......
| :method:`post`
| :path:`/v2/consumer_groups/<group_id>/actions/content/uninstall/`
| :permission:`create`
| :permission:`execute`
| :param_list:`post`
* :param:`units,array,array of content units to uninstall`
server/pulp/server/webservices/views/consumer_groups.py
Views for content manipulation on consumer group.
"""
@auth_required(authorization.CREATE)
@auth_required(authorization.EXECUTE)
@json_body_allow_empty
def post(self, request, consumer_group_id, action):
"""
server/pulp/server/webservices/views/consumers.py
Views for content manipulation on the consumer.
"""
@auth_required(authorization.CREATE)
@auth_required(authorization.EXECUTE)
@json_body_required
def post(self, request, consumer_id, action):
"""
server/test/unit/server/webservices/views/test_consumer_groups.py
"""
@mock.patch('pulp.server.webservices.controllers.decorators._verify_auth',
new=assert_auth_CREATE())
new=assert_auth_EXECUTE())
def test_consumer_group_bad_request_content(self):
"""
Test consumer group invalid content action.
......
self.assertEqual(response.status_code, 400)
@mock.patch('pulp.server.webservices.controllers.decorators._verify_auth',
new=assert_auth_CREATE())
new=assert_auth_EXECUTE())
@mock.patch('pulp.server.webservices.views.consumer_groups.factory')
def test_consumer_group_content_install(self, mock_factory):
"""
......
'my-group', [], {})
@mock.patch('pulp.server.webservices.controllers.decorators._verify_auth',
new=assert_auth_CREATE())
new=assert_auth_EXECUTE())
@mock.patch('pulp.server.webservices.views.consumer_groups.factory')
def test_consumer_group_content_update(self, mock_factory):
"""
......
'my-group', [], {})
@mock.patch('pulp.server.webservices.controllers.decorators._verify_auth',
new=assert_auth_CREATE())
new=assert_auth_EXECUTE())
@mock.patch('pulp.server.webservices.views.consumer_groups.factory')
def test_consumer_group_content_uninstall(self, mock_factory):
"""
server/test/unit/server/webservices/views/test_consumers.py
import mock
from django.http import HttpResponseBadRequest
from base import assert_auth_CREATE, assert_auth_DELETE, assert_auth_READ, assert_auth_UPDATE
from base import (assert_auth_CREATE, assert_auth_DELETE, assert_auth_EXECUTE, assert_auth_READ,
assert_auth_UPDATE)
from pulp.server.exceptions import (InvalidValue, MissingResource, MissingValue,
OperationPostponed, UnsupportedValue)
from pulp.server.webservices.views import consumers
......
"""
@mock.patch('pulp.server.webservices.controllers.decorators._verify_auth',
new=assert_auth_CREATE())
new=assert_auth_EXECUTE())
def test_consumer_bad_request_content(self):
"""
Test consumer invalid content action.
......
self.assertEqual(response.status_code, 400)
@mock.patch('pulp.server.webservices.controllers.decorators._verify_auth',
new=assert_auth_CREATE())
new=assert_auth_EXECUTE())
@mock.patch('pulp.server.webservices.views.consumers.factory.consumer_manager')
def test_consumer_content_install_missing_cons(self, mock_consumer):
"""
......
self.assertEqual(response.error_data['resources'], {'consumer_id': 'my-consumer'})
@mock.patch('pulp.server.webservices.controllers.decorators._verify_auth',
new=assert_auth_CREATE())
new=assert_auth_EXECUTE())
@mock.patch('pulp.server.webservices.views.consumers.factory.consumer_manager')
def test_consumer_content_install_missing_units(self, mock_consumer):
"""
......
self.assertEqual(response.error_data['property_names'], ['units'])
@mock.patch('pulp.server.webservices.controllers.decorators._verify_auth',
new=assert_auth_CREATE())
new=assert_auth_EXECUTE())
@mock.patch('pulp.server.webservices.views.consumers.factory.consumer_manager')
def test_consumer_content_install_missing_options(self, mock_consumer):
"""
......
self.assertEqual(response.error_data['property_names'], ['options'])
@mock.patch('pulp.server.webservices.controllers.decorators._verify_auth',
new=assert_auth_CREATE())
new=assert_auth_EXECUTE())
@mock.patch('pulp.server.webservices.views.consumers.factory.consumer_manager')
@mock.patch('pulp.server.webservices.views.consumers.factory.consumer_agent_manager')
def test_consumer_content_install(self, mock_factory, mock_consumer):
......
'my-consumer', [], {})
@mock.patch('pulp.server.webservices.controllers.decorators._verify_auth',
new=assert_auth_CREATE())
new=assert_auth_EXECUTE())
@mock.patch('pulp.server.webservices.views.consumers.factory.consumer_manager')
@mock.patch('pulp.server.webservices.views.consumers.factory.consumer_agent_manager')
def test_consumer_content_update(self, mock_factory, mock_consumer):
......
'my-consumer', [], {})
@mock.patch('pulp.server.webservices.controllers.decorators._verify_auth',
new=assert_auth_CREATE())
new=assert_auth_EXECUTE())
@mock.patch('pulp.server.webservices.views.consumers.factory.consumer_manager')
@mock.patch('pulp.server.webservices.views.consumers.factory.consumer_agent_manager')
def test_consumer_content_uninstall(self, mock_factory, mock_consumer):
    (1-1/1)