def test_put_repo_group_distributor_no_config_specified(self, mock_factory, mock_resp): """ Modifiy a distributor without specifying the distributor_config. """ mock_request = mock.MagicMock() mock_request.body = json.dumps({'no_dist_config': 'mock_conf'}) repo_group_distributor_resource = RepoGroupDistributorResourceView() try: repo_group_distributor_resource.put(mock_request, 'group_id', 'dist_id') except pulp_exceptions.MissingValue, response: pass
def test_delete_repo_group_distributor(self, mock_factory, mock_resp, mock_rev): """ Delete a repo group distributor. """ mock_request = mock.MagicMock() mock_request.body = json.dumps({'force': True}) mock_dist_manager = mock_factory.repo_group_distributor_manager.return_value repo_group_distributor_resource = RepoGroupDistributorResourceView() response = repo_group_distributor_resource.delete(mock_request, 'group_id', 'dist_id') mock_resp.assert_called_once_with(None) mock_dist_manager.remove_distributor.assert_called_once_with( 'group_id', 'dist_id', force=True) self.assertTrue(response is mock_resp.return_value)
def test_get_repo_group_distributor(self, mock_factory, mock_resp, mock_rev): """ Get a single repo_groups distributor. """ mock_request = mock.MagicMock() mock_rev.return_value = '/mock/path/' mock_dist_manager = mock_factory.repo_group_distributor_manager.return_value mock_dist_manager.get_distributor.return_value = {'id': 'dist1'} repo_group_distributor_resource = RepoGroupDistributorResourceView() response = repo_group_distributor_resource.get(mock_request, 'group_id', 'dist_id') expected_content = {'id': 'dist1', '_href': '/mock/path/'} mock_resp.assert_called_once_with(expected_content) mock_dist_manager.get_distributor.assert_called_once_with('group_id', 'dist_id') self.assertTrue(response is mock_resp.return_value)
def test_put_repo_group_distributor(self, mock_factory, mock_resp, mock_rev): """ Modifiy a distributor with required argument. """ mock_request = mock.MagicMock() mock_rev.return_value = '/mock/path/' mock_request.body = json.dumps({'distributor_config': 'mock_conf'}) mock_dist_manager = mock_factory.repo_group_distributor_manager.return_value mock_dist_manager.update_distributor_config.return_value = {'updated': 'distributor'} repo_group_distributor_resource = RepoGroupDistributorResourceView() response = repo_group_distributor_resource.put(mock_request, 'group_id', 'dist_id') expected_content = {'updated': 'distributor', '_href': '/mock/path/'} mock_resp.assert_called_once_with(expected_content) mock_dist_manager.update_distributor_config.assert_called_once_with( 'group_id', 'dist_id', 'mock_conf') self.assertTrue(response is mock_resp.return_value)
url(r'^v2/plugins/types/$', TypesView.as_view(), name='plugin_types'), url(r'^v2/plugins/types/(?P<type_id>[^/]+)/$', TypeResourceView.as_view(), name='plugin_type_resource'), url(r'^v2/repo_groups/$', RepoGroupsView.as_view(), name='repo_groups'), url(r'^v2/repo_groups/(?P<repo_group_id>[^/]+)/$', RepoGroupResourceView.as_view(), name='repo_group_resource'), url(r'^v2/repo_groups/(?P<repo_group_id>[^/]+)/actions/associate/$', RepoGroupAssociateView.as_view(), name='repo_group_associate'), url(r'^v2/repo_groups/(?P<repo_group_id>[^/]+)/actions/publish/$', RepoGroupPublishView.as_view(), name='repo_group_publish'), url(r'^v2/repo_groups/(?P<repo_group_id>[^/]+)/actions/unassociate/$', RepoGroupUnassociateView.as_view(), name='repo_group_unassociate'), url(r'^v2/repo_groups/(?P<repo_group_id>[^/]+)/distributors/$', RepoGroupDistributorsView.as_view(), name='repo_group_distributors'), url(r'^v2/repo_groups/(?P<repo_group_id>[^/]+)/distributors/(?P<distributor_id>[^/]+)/$', RepoGroupDistributorResourceView.as_view(), name='repo_group_distributor_resource'), url(r'^v2/repositories/$', ReposView.as_view(), name='repos'), url(r'^v2/repositories/actions/content/regenerate_applicability/$', ContentApplicabilityRegenerationView.as_view(), name='repo_content_app_regen'), url(r'^v2/repositories/(?P<repo_id>[^/]+)/$', RepoResourceView.as_view(), name='repo_resource'), url(r'^v2/repositories/(?P<repo_id>[^/]+)/importers/$', RepoImportersView.as_view(), name='repo_importers'), url(r'^v2/repositories/(?P<repo_id>[^/]+)/importers/(?P<importer_id>[^/]+)/$', RepoImporterResourceView.as_view(), name='repo_importer_resource'), url(r'^v2/repositories/(?P<repo_id>[^/]+)/importers/(?P<importer_id>[^/]+)/schedules/sync/$', RepoSyncSchedulesView.as_view(), name='repo_sync_schedules'), url(r'^v2/repositories/(?P<repo_id>[^/]+)/importers/(?P<importer_id>[^/]+)/schedules/sync/(?P<schedule_id>[^/]+)/$', RepoSyncScheduleResourceView.as_view(), name='repo_sync_schedule_resource'), url(r'^v2/repositories/(?P<repo_id>[^/]+)/distributors/$', RepoDistributorsView.as_view(), name='repo_distributors'), url(r'^v2/repositories/(?P<repo_id>[^/]+)/distributors/(?P<distributor_id>[^/]+)/$',
RepoGroupResourceView.as_view(), name='repo_group_resource'), url(r'^v2/repo_groups/(?P<repo_group_id>[^/]+)/actions/associate/$', RepoGroupAssociateView.as_view(), name='repo_group_associate'), url(r'^v2/repo_groups/(?P<repo_group_id>[^/]+)/actions/publish/$', RepoGroupPublishView.as_view(), name='repo_group_publish'), url(r'^v2/repo_groups/(?P<repo_group_id>[^/]+)/actions/unassociate/$', RepoGroupUnassociateView.as_view(), name='repo_group_unassociate'), url(r'^v2/repo_groups/(?P<repo_group_id>[^/]+)/distributors/$', RepoGroupDistributorsView.as_view(), name='repo_group_distributors'), url(r'^v2/repo_groups/(?P<repo_group_id>[^/]+)/distributors/(?P<distributor_id>[^/]+)/$', RepoGroupDistributorResourceView.as_view(), name='repo_group_distributor_resource'), url(r'^v2/repositories/$', ReposView.as_view(), name='repos'), url(r'^v2/repositories/search/$', RepoSearch.as_view(), name='repo_search'), url(r'^v2/repositories/actions/content/regenerate_applicability/$', ContentApplicabilityRegenerationView.as_view(), name='repo_content_app_regen'), url(r'^v2/repositories/(?P<repo_id>[^/]+)/$', RepoResourceView.as_view(), name='repo_resource'), url(r'^v2/repositories/(?P<repo_id>[^/]+)/search/units/$', RepoUnitSearch.as_view(), name='repo_unit_search'), url(r'^v2/repositories/(?P<repo_id>[^/]+)/importers/$', RepoImportersView.as_view(),
url(r'^v2/plugins/types/(?P<type_id>[^/]+)/$', TypeResourceView.as_view(), name='plugin_type_resource'), url(r'^v2/repo_groups/$', RepoGroupsView.as_view(), name='repo_groups'), url(r'^v2/repo_groups/search/$', RepoGroupSearch.as_view(), name='repo_group_search'), url(r'^v2/repo_groups/(?P<repo_group_id>[^/]+)/$', RepoGroupResourceView.as_view(), name='repo_group_resource'), url(r'^v2/repo_groups/(?P<repo_group_id>[^/]+)/actions/associate/$', RepoGroupAssociateView.as_view(), name='repo_group_associate'), url(r'^v2/repo_groups/(?P<repo_group_id>[^/]+)/actions/publish/$', RepoGroupPublishView.as_view(), name='repo_group_publish'), url(r'^v2/repo_groups/(?P<repo_group_id>[^/]+)/actions/unassociate/$', RepoGroupUnassociateView.as_view(), name='repo_group_unassociate'), url(r'^v2/repo_groups/(?P<repo_group_id>[^/]+)/distributors/$', RepoGroupDistributorsView.as_view(), name='repo_group_distributors'), url(r'^v2/repo_groups/(?P<repo_group_id>[^/]+)/distributors/(?P<distributor_id>[^/]+)/$', RepoGroupDistributorResourceView.as_view(), name='repo_group_distributor_resource'), url(r'^v2/repositories/$', ReposView.as_view(), name='repos'), url(r'^v2/repositories/search/$', RepoSearch.as_view(), name='repo_search'), url(r'^v2/repositories/actions/content/regenerate_applicability/$', ContentApplicabilityRegenerationView.as_view(), name='repo_content_app_regen'), url(r'^v2/repositories/(?P<repo_id>[^/]+)/$', RepoResourceView.as_view(), name='repo_resource'), url(r'^v2/repositories/(?P<repo_id>[^/]+)/search/units/$', RepoUnitSearch.as_view(), name='repo_unit_search'), url(r'^v2/repositories/(?P<repo_id>[^/]+)/importers/$', RepoImportersView.as_view(), name='repo_importers'), url(r'^v2/repositories/(?P<repo_id>[^/]+)/importers/(?P<importer_id>[^/]+)/$', RepoImporterResourceView.as_view(), name='repo_importer_resource'), url(r'^v2/repositories/(?P<repo_id>[^/]+)/importers/(?P<importer_id>[^/]+)/schedules/sync/$', RepoSyncSchedulesView.as_view(), name='repo_sync_schedules'), url(r'^v2/repositories/(?P<repo_id>[^/]+)/importers/(?P<importer_id>[^/]+)/schedules/sync/(?P<schedule_id>[^/]+)/$', RepoSyncScheduleResourceView.as_view(), name='repo_sync_schedule_resource'), url(r'^v2/repositories/(?P<repo_id>[^/]+)/distributors/$', RepoDistributorsView.as_view(),