def test_post_bad_request_content_source(self): """ Test content source invalid action """ request = mock.MagicMock() request.body = None content_source_view = ContentSourceCollectionActionView() response = content_source_view.post(request, 'no-such-action') self.assertTrue(isinstance(response, HttpResponseBadRequest)) self.assertEqual(response.status_code, 400)
def test_refresh_content_source(self, mock_refresh, mock_sources, mock_tags): """ Test refresh content sources """ source = mock.MagicMock() source.id = 'some-source' source.dict.return_value = {'source_id': 'some-source'} mock_sources.return_value = {'some-source': source} mock_task_tags = [mock_tags.action_tag.return_value, mock_tags.resource_tag.return_value] request = mock.MagicMock() request.body = None content_source_view = ContentSourceCollectionActionView() try: content_source_view.post(request, 'refresh') except OperationPostponed, response: pass
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/$', ContentSourceCollectionView.as_view(), name='content_sources'), url(r'^v2/content/sources/action/(?P<action>[^/]+)/$', ContentSourceCollectionActionView.as_view(), name='content_sources_action'), url(r'^v2/content/sources/(?P<source_id>[^/]+)/action/(?P<action>[^/]+)/$', ContentSourceResourceActionView.as_view(), name='content_sources_resource_action'), url(r'^v2/content/sources/(?P<source_id>[^/]+)/$', ContentSourceResourceView.as_view(), name='content_sources_resource'), url(r'^v2/content/units/(?P<type_id>[^/]+)/$', ContentUnitsCollectionView.as_view(), name='content_units_collection'), url(r'^v2/content/units/(?P<type_id>[^/]+)/search/$', ContentUnitSearch.as_view(), name='content_unit_search'), url(r'^v2/content/units/(?P<type_id>[^/]+)/(?P<unit_id>[^/]+)/$', ContentUnitResourceView.as_view(),
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/$', ContentSourceCollectionView.as_view(), name='content_sources'), url(r'^v2/content/sources/action/(?P<action>[^/]+)/$', ContentSourceCollectionActionView.as_view(), name='content_sources_action'), url(r'^v2/content/sources/(?P<source_id>[^/]+)/action/(?P<action>[^/]+)/$', ContentSourceResourceActionView.as_view(), name='content_sources_resource_action'), url(r'^v2/content/sources/(?P<source_id>[^/]+)/$', ContentSourceResourceView.as_view(), name='content_sources_resource'), url(r'^v2/content/units/(?P<type_id>[^/]+)/$', ContentUnitsCollectionView.as_view(), name='content_units_collection'), url(r'^v2/content/units/(?P<type_id>[^/]+)/search/$', ContentUnitSearch.as_view(), name='content_unit_search'), url(r'^v2/content/units/(?P<type_id>[^/]+)/(?P<unit_id>[^/]+)/$', ContentUnitResourceView.as_view(), name='content_unit_resource'), url(r'^v2/content/units/(?P<type_id>[^/]+)/(?P<unit_id>[^/]+)/pulp_user_metadata/$', ContentUnitUserMetadataResourceView.as_view(), name='content_unit_user_metadata_resource'), url(r'^v2/content/uploads/$', UploadsCollectionView.as_view(), name='content_uploads'), url(r'^v2/content/uploads/(?P<upload_id>[^/]+)/$', UploadResourceView.as_view(),