Пример #1
0
    def test_get_repo_group_resource_not_found(self, mock_model):
        """
        Get a repo group that does not exist.
        """
        mock_model.get_collection.return_value.find_one.return_value = None
        mock_request = mock.MagicMock()

        repo_groups_resource = RepoGroupResourceView()
        try:
            repo_groups_resource.get(mock_request, 'mock_id')
        except pulp_exceptions.MissingResource, response:
            pass
Пример #2
0
    def test_delete_repo_group_resource(self, mock_factory, mock_resp):
        """
        Delete a repo group.
        """
        mock_manager = mock_factory.repo_group_manager.return_value
        mock_request = mock.MagicMock()

        repo_group_resource = RepoGroupResourceView()
        response = repo_group_resource.delete(mock_request, 'mock_id')

        mock_resp.assert_called_once_with(None)
        mock_manager.delete_repo_group.assert_called_once_with('mock_id')
        self.assertTrue(response is mock_resp.return_value)
Пример #3
0
    def test_get_repo_group_resource(self, mock_model, mock_resp, mock_rev):
        """
        Get a repo group that exists.
        """
        mock_model.get_collection.return_value.find_one.return_value = {'id': 'mock_group'}
        mock_request = mock.MagicMock()
        mock_rev.return_value = '/mock/path/'

        repo_groups_resource = RepoGroupResourceView()
        response = repo_groups_resource.get(mock_request, 'mock_id')

        expected_content = {'id': 'mock_group', '_href': '/mock/path/'}
        mock_resp.assert_called_once_with(expected_content)
        self.assertTrue(response is mock_resp.return_value)
Пример #4
0
    def test_update_repo_group_resource(self, mock_factory, mock_resp, mock_rev):
        """
        Update a repo group.
        """
        mock_req = mock.MagicMock()
        mock_req.body = json.dumps({'mock': 'body'})
        mock_rev.return_value = '/mock/path/'
        mock_manager = mock_factory.repo_group_manager.return_value
        mock_manager.update_repo_group.return_value = {'mock': 'group', 'id': 'test'}

        repo_group_resource = RepoGroupResourceView()
        response = repo_group_resource.put(mock_req, 'mock_id')

        mock_resp.assert_called_once_with({'mock': 'group', '_href': '/mock/path/', 'id': 'test'})
        mock_manager.update_repo_group.assert_called_once_with('mock_id', mock='body')
        self.assertTrue(response is mock_resp.return_value)
Пример #5
0
 url(r'^v2/permissions/$', PermissionView.as_view(), name='permissions'),
 url(r'^v2/permissions/actions/grant_to_role/$', GrantToRoleView.as_view(), name='grant_to_role'),
 url(r'^v2/permissions/actions/grant_to_user/$', GrantToUserView.as_view(), name='grant_to_user'),
 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'),
Пример #6
0
 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(),
Пример #7
0
 url(r'^v2/permissions/actions/grant_to_role/$', GrantToRoleView.as_view(), name='grant_to_role'),
 url(r'^v2/permissions/actions/grant_to_user/$', GrantToUserView.as_view(), name='grant_to_user'),
 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/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'),