Exemple #1
0
 def test_consumer_group_bad_request_content(self):
     """
     Test consumer group invalid content action.
     """
     request = mock.MagicMock()
     consumer_group_content = ConsumerGroupContentActionView()
     response = consumer_group_content.post(request, 'my-group', 'no_such_action')
     self.assertTrue(isinstance(response, HttpResponseBadRequest))
     self.assertEqual(response.status_code, 400)
Exemple #2
0
 def test_consumer_group_bad_request_content(self):
     """
     Test consumer group invalid content action.
     """
     request = mock.MagicMock()
     consumer_group_content = ConsumerGroupContentActionView()
     response = consumer_group_content.post(request, 'my-group',
                                            'no_such_action')
     self.assertTrue(isinstance(response, HttpResponseBadRequest))
     self.assertEqual(response.status_code, 400)
Exemple #3
0
 def test_consumer_group_content_uninstall(self, mock_factory):
     """
     Test consumer group content uninstall.
     """
     mock_factory.consumer_group_manager.return_value.uninstall_content.return_value = 'ok'
     request = mock.MagicMock()
     request.body_as_json = {"units": [], "options": {}}
     consumer_group_content = ConsumerGroupContentActionView()
     self.assertRaises(OperationPostponed, consumer_group_content.post,
                       request, 'my-group', 'uninstall')
     mock_factory.consumer_group_manager(
     ).uninstall_content.assert_called_once_with('my-group', [], {})
Exemple #4
0
urlpatterns = patterns(
    '',
    url(r'^v2/actions/login/$', LoginView.as_view(),
        name='login'),  # flake8: noqa
    url(r'^v2/consumer_groups/(?P<consumer_group_id>[^/]+)/$',
        ConsumerGroupResourceView.as_view(),
        name='consumer_group_resource'),
    url(r'^v2/consumer_groups/(?P<consumer_group_id>[^/]+)/actions/associate/$',
        ConsumerGroupAssociateActionView.as_view(),
        name='consumer_group_associate'),
    url(r'^v2/consumer_groups/(?P<consumer_group_id>[^/]+)/actions/unassociate/$',
        ConsumerGroupUnassociateActionView.as_view(),
        name='consumer_group_unassociate'),
    url(r'^v2/consumer_groups/(?P<consumer_group_id>[^/]+)/actions/content/(?P<action>[^/]+)/$',
        ConsumerGroupContentActionView.as_view(),
        name='consumer_group_content'),
    url(r'^v2/consumer_groups/(?P<consumer_group_id>[^/]+)/bindings/$',
        ConsumerGroupBindingsView.as_view(),
        name='consumer_group_bind'),
    url(r'^v2/consumer_groups/(?P<consumer_group_id>[^/]+)' +
        r'/bindings/(?P<repo_id>[^/]+)/(?P<distributor_id>[^/]+)/$',
        ConsumerGroupBindingView.as_view(),
        name='consumer_group_unbind'),
    url(r'^v2/content/actions/delete_orphans/$',
        DeleteOrphansActionView.as_view(),
        name='content_actions_delete_orphans'),
    url(r'^v2/content/catalog/(?P<source_id>[^/]+)/$',
        CatalogResourceView.as_view(),
        name='content_catalog_resource'),
    url(r'^v2/content/orphans/$',
Exemple #5
0
 url(r'^v2/consumers/(?P<consumer_id>[^/]+)/schedules/content/update/(?P<schedule_id>[^/]+)/$',
     UnitUpdateScheduleResourceView.as_view(), name='schedule_content_update_resource'),
 url(r'^v2/consumers/(?P<consumer_id>[^/]+)/schedules/content/uninstall/$',
     UnitUninstallSchedulesView.as_view(), name='schedule_content_uninstall'),
 url(r'^v2/consumers/(?P<consumer_id>[^/]+)/schedules/content/uninstall/(?P<schedule_id>[^/]+)/$',
     UnitUninstallScheduleResourceView.as_view(), name='schedule_content_uninstall_resource'),
 url(r'^v2/consumers/(?P<consumer_id>[^/]+)/history/$',
     ConsumerHistoryView.as_view(), name='consumer_history'),
 url(r'^v2/consumer_groups/(?P<consumer_group_id>[^/]+)/$',
     ConsumerGroupResourceView.as_view(), name='consumer_group_resource'),
 url(r'^v2/consumer_groups/(?P<consumer_group_id>[^/]+)/actions/associate/$',
     ConsumerGroupAssociateActionView.as_view(), name='consumer_group_associate'),
 url(r'^v2/consumer_groups/(?P<consumer_group_id>[^/]+)/actions/unassociate/$',
     ConsumerGroupUnassociateActionView.as_view(), name='consumer_group_unassociate'),
 url(r'^v2/consumer_groups/(?P<consumer_group_id>[^/]+)/actions/content/(?P<action>[^/]+)/$',
     ConsumerGroupContentActionView.as_view(), name='consumer_group_content'),
 url(r'^v2/consumer_groups/(?P<consumer_group_id>[^/]+)/bindings/$',
     ConsumerGroupBindingsView.as_view(), name='consumer_group_bind'),
 url(r'^v2/consumer_groups/(?P<consumer_group_id>[^/]+)' +
     r'/bindings/(?P<repo_id>[^/]+)/(?P<distributor_id>[^/]+)/$',
     ConsumerGroupBindingView.as_view(), name='consumer_group_unbind'),
 url(r'^v2/content/actions/delete_orphans/$', DeleteOrphansActionView.as_view(),
     name='content_actions_delete_orphans'),
 url(r'^v2/content/catalog/(?P<source_id>[^/]+)/$', CatalogResourceView.as_view(),
     name='content_catalog_resource'),
 url(r'^v2/content/orphans/$', OrphanCollectionView.as_view(), name='content_orphan_collection'),
 url(r'^v2/content/orphans/(?P<content_type>[^/]+)/$', OrphanTypeSubCollectionView.as_view(),
     name='content_orphan_type_subcollection'),
 url(r'^v2/content/orphans/(?P<content_type>[^/]+)/(?P<unit_id>[^/]+)/$',
     OrphanResourceView.as_view(), name='content_orphan_resource'),
 url(r'^v2/content/sources/$', ContentSourceView.as_view(),
Exemple #6
0
 url(r'^v2/consumers/(?P<consumer_id>[^/]+)/schedules/content/uninstall/$',
     UnitUninstallSchedulesView.as_view(), name='schedule_content_uninstall'),
 url(r'^v2/consumers/(?P<consumer_id>[^/]+)/schedules/content/uninstall/(?P<schedule_id>[^/]+)/$',
     UnitUninstallScheduleResourceView.as_view(), name='schedule_content_uninstall_resource'),
 url(r'^v2/consumers/(?P<consumer_id>[^/]+)/history/$',
     ConsumerHistoryView.as_view(), name='consumer_history'),
 url(r'^v2/consumer_groups/search/$',
     ConsumerGroupSearchView.as_view(), name='consumer_group_search'),
 url(r'^v2/consumer_groups/(?P<consumer_group_id>[^/]+)/$',
     ConsumerGroupResourceView.as_view(), name='consumer_group_resource'),
 url(r'^v2/consumer_groups/(?P<consumer_group_id>[^/]+)/actions/associate/$',
     ConsumerGroupAssociateActionView.as_view(), name='consumer_group_associate'),
 url(r'^v2/consumer_groups/(?P<consumer_group_id>[^/]+)/actions/unassociate/$',
     ConsumerGroupUnassociateActionView.as_view(), name='consumer_group_unassociate'),
 url(r'^v2/consumer_groups/(?P<consumer_group_id>[^/]+)/actions/content/(?P<action>[^/]+)/$',
     ConsumerGroupContentActionView.as_view(), name='consumer_group_content'),
 url(r'^v2/consumer_groups/(?P<consumer_group_id>[^/]+)/bindings/$',
     ConsumerGroupBindingsView.as_view(), name='consumer_group_bind'),
 url(r'^v2/consumer_groups/(?P<consumer_group_id>[^/]+)' +
     r'/bindings/(?P<repo_id>[^/]+)/(?P<distributor_id>[^/]+)/$',
     ConsumerGroupBindingView.as_view(), name='consumer_group_unbind'),
 url(r'^v2/content/actions/delete_orphans/$', DeleteOrphansActionView.as_view(),
     name='content_actions_delete_orphans'),
 url(r'^v2/content/catalog/(?P<source_id>[^/]+)/$', CatalogResourceView.as_view(),
     name='content_catalog_resource'),
 url(r'^v2/content/orphans/$', OrphanCollectionView.as_view(), name='content_orphan_collection'),
 url(r'^v2/content/orphans/(?P<content_type>[^/]+)/$', OrphanTypeSubCollectionView.as_view(),
     name='content_orphan_type_subcollection'),
 url(r'^v2/content/orphans/(?P<content_type>[^/]+)/(?P<unit_id>[^/]+)/$',
     OrphanResourceView.as_view(), name='content_orphan_resource'),
 url(r'^v2/content/sources/$',