def test_post_repo_group_associate(self, mock_factory, mock_criteria, mock_model, mock_resp): """ Associate a repo to a repo_group. """ mock_request = mock.MagicMock() mock_request.body = '{}' mock_manager = mock_factory.repo_group_manager.return_value criteria = mock_criteria.from_client_input.return_value mock_collection = mock_model.get_collection.return_value mock_group = mock_collection.find_one.return_value repo_group_associate = RepoGroupAssociateView() response = repo_group_associate.post(mock_request, 'mock_id') mock_manager.associate.assert_called_once_with('mock_id', criteria) mock_resp.assert_called_once_with(mock_group['repo_ids']) self.assertTrue(response is mock_resp.return_value)
url(r'^v2/permissions/actions/revoke_from_role/$', RevokeFromRoleView.as_view(), name='revoke_from_role'), url(r'^v2/permissions/actions/revoke_from_user/$', RevokeFromUserView.as_view(), name='revoke_from_user'), url(r'^v2/plugins/distributors/$', DistributorsView.as_view(), name='plugin_distributors'), url(r'^v2/plugins/distributors/(?P<distributor_id>[^/]+)/$', DistributorResourceView.as_view(), name='plugin_distributor_resource'), url(r'^v2/plugins/importers/$', ImportersView.as_view(), name='plugin_importers'), url(r'^v2/plugins/importers/(?P<importer_id>[^/]+)/$', ImporterResourceView.as_view(), name='plugin_importer_resource'), 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>[^/]+)/$',
url(r'^v2/plugins/importers/(?P<importer_id>[^/]+)/$', ImporterResourceView.as_view(), name='plugin_importer_resource'), 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/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(),
url(r'^v2/permissions/actions/revoke_from_user/$', RevokeFromUserView.as_view(), name='revoke_from_user'), url(r'^v2/plugins/distributors/$', DistributorsView.as_view(), name='plugin_distributors'), url(r'^v2/plugins/distributors/(?P<distributor_id>[^/]+)/$', DistributorResourceView.as_view(), name='plugin_distributor_resource'), url(r'^v2/plugins/importers/$', ImportersView.as_view(), name='plugin_importers'), url(r'^v2/plugins/importers/(?P<importer_id>[^/]+)/$', ImporterResourceView.as_view(), name='plugin_importer_resource'), 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/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(),