def test_cons_group_unassociation_view(self, mock_factory, mock_resp): """ Test consumer group unassociate a consumer. """ grp = {'id': 'my-group', 'consumer_ids': []} mock_factory.consumer_group_manager.return_value.unassociate.return_value = 'ok' mock_factory.consumer_group_query_manager.return_value.get_group.return_value = grp request = mock.MagicMock() request.body_as_json = {'criteria': {'filters': {'id': 'c1'}}} consumer_group_unassociate = ConsumerGroupUnassociateActionView() response = consumer_group_unassociate.post(request, 'my-group') mock_resp.assert_called_once_with([]) self.assertTrue(response is mock_resp.return_value)
ImportersView, TypeResourceView, TypesView) from pulp.server.webservices.views.root_actions import LoginView 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>[^/]+)/$',
url(r'^v2/consumers/(?P<consumer_id>[^/]+)/schedules/content/update/$', UnitUpdateSchedulesView.as_view(), name='schedule_content_update'), 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>[^/]+)/$',
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/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>[^/]+)/$',