コード例 #1
0
ファイル: test_events.py プロジェクト: pombreda/pulp
    def test_update_event(self, mock_factory, mock_resp):
        """
        Test event update
        """
        resp = {
            'notifier_type_id': 'http',
            'id': '12345',
            'event_types': ['some']
        }
        mock_factory.event_listener_manager.return_value.update.return_value = resp

        request = mock.MagicMock()
        request.body = json.dumps({'event_types': ['some']})
        event_listeners = EventResourceView()
        response = event_listeners.put(request, '12345')

        expected_cont = {
            'id': '12345',
            '_href': '/v2/events/12345/',
            'notifier_type_id': 'http',
            'event_types': ['some']
        }

        mock_resp.assert_called_once_with(expected_cont)
        self.assertTrue(response is mock_resp.return_value)
コード例 #2
0
ファイル: test_events.py プロジェクト: taftsanders/pulp
    def test_delete_single_event(self, mock_factory, mock_resp):
        """
        Test event deletion.
        """
        mock_factory.event_listener_manager.return_value.delete.return_value = None

        request = mock.MagicMock()
        event_listeners = EventResourceView()
        response = event_listeners.delete(request, '12345')

        mock_factory.event_listener_manager.return_value.delete.assert_called_once_with('12345')
        mock_resp.assert_called_once_with(None)
        self.assertTrue(response is mock_resp.return_value)
コード例 #3
0
ファイル: test_events.py プロジェクト: taftsanders/pulp
    def test_get_single_event(self, mock_factory, mock_resp):
        """
        Test single event retrieval.
        """
        event = {'notifier_type_id': 'http', 'id': '12345'}
        mock_factory.event_listener_manager.return_value.get.return_value = event

        request = mock.MagicMock()
        event_listeners = EventResourceView()
        response = event_listeners.get(request, '12345')

        expected_cont = {'id': '12345', '_href': '/v2/events/12345/', 'notifier_type_id': 'http'}
        mock_resp.assert_called_once_with(expected_cont)
        mock_factory.event_listener_manager.return_value.get.assert_called_once_with('12345')
        self.assertTrue(response is mock_resp.return_value)
コード例 #4
0
ファイル: test_events.py プロジェクト: alanoe/pulp
    def test_update_event(self, mock_factory, mock_resp):
        """
        Test event update
        """
        resp = {'notifier_type_id': 'http', 'id': '12345', 'event_types': ['some']}
        mock_factory.event_listener_manager.return_value.update.return_value = resp

        request = mock.MagicMock()
        request.body = json.dumps({'event_types': ['some']})
        event_listeners = EventResourceView()
        response = event_listeners.put(request, '12345')

        expected_cont = {'id': '12345', '_href': '/v2/events/12345/', 'notifier_type_id': 'http',
                         'event_types': ['some']}

        mock_resp.assert_called_once_with(expected_cont)
        self.assertTrue(response is mock_resp.return_value)
コード例 #5
0
ファイル: urls.py プロジェクト: hgschmie/pulp
     name='content_types'),
 url(r'^v2/content/types/(?P<type_id>[^/]+)/$', ContentTypeResourceView.as_view(),
     name='content_type_resource'),
 url(r'^v2/content/units/(?P<type_id>[^/]+)/$', ContentUnitsCollectionView.as_view(),
     name='content_units_collection'),
 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(),
     name='content_upload_resource'),
 url(r'^v2/content/uploads/(?P<upload_id>[^/]+)/(?P<offset>[^/]+)/$',
     UploadSegmentResourceView.as_view(), name='content_upload_segment_resource'),
 url(r'^v2/events/$', EventView.as_view(), name='events'),
 url(r'^v2/events/(?P<event_listener_id>[^/]+)/$', EventResourceView.as_view(), name='event_resource'),
 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'),
コード例 #6
0
ファイル: urls.py プロジェクト: credativ/pulp
     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(),
     name='content_upload_resource'),
 url(r'^v2/content/uploads/(?P<upload_id>[^/]+)/(?P<offset>[^/]+)/$',
     UploadSegmentResourceView.as_view(),
     name='content_upload_segment_resource'),
 url(r'^v2/distributors/search/$',
     RepoDistributorsSearchView.as_view(),
     name='distributor_search'),
 url(r'^v2/events/$', EventView.as_view(), name='events'),
 url(r'^v2/events/(?P<event_listener_id>[^/]+)/$',
     EventResourceView.as_view(),
     name='event_resource'),
 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/$',
コード例 #7
0
     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(),
     name='content_upload_resource'),
 url(r'^v2/content/uploads/(?P<upload_id>[^/]+)/(?P<offset>[^/]+)/$',
     UploadSegmentResourceView.as_view(), name='content_upload_segment_resource'),
 url(r'^v2/distributors/search/$', RepoDistributorsSearchView.as_view(),
     name='distributor_search'),
 url(r'^v2/events/$', EventView.as_view(), name='events'),
 url(r'^v2/events/(?P<event_listener_id>[^/]+)/$', EventResourceView.as_view(), name='event_resource'),
 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'),