예제 #1
0
파일: test_roles.py 프로젝트: alanoe/pulp
    def test_add_invalid_user_to_role(self):
        """
        Test add invalid user to a role.
        """
        request = mock.MagicMock()
        request.body = json.dumps({'login': None})
        role_users = RoleUsersView()

        try:
            response = role_users.post(request, 'test-role')
        except InvalidValue, response:
            pass
예제 #2
0
    def test_add_invalid_user_to_role(self):
        """
        Test add invalid user to a role.
        """
        request = mock.MagicMock()
        request.body = json.dumps({'login': None})
        role_users = RoleUsersView()

        try:
            response = role_users.post(request, 'test-role')
        except InvalidValue, response:
            pass
예제 #3
0
    def test_add_user_to_role(self, mock_factory, mock_resp):
        """
        Test add user to a role.
        """
        mock_factory.role_manager.return_value.add_user_to_role.return_value = None

        request = mock.MagicMock()
        request.body = json.dumps({'login': '******'})
        role_users = RoleUsersView()
        response = role_users.post(request, 'test-role')

        mock_resp.assert_called_once_with(None)
        self.assertTrue(response is mock_resp.return_value)
예제 #4
0
파일: test_roles.py 프로젝트: alanoe/pulp
    def test_add_user_to_role(self, mock_factory, mock_resp):
        """
        Test add user to a role.
        """
        mock_factory.role_manager.return_value.add_user_to_role.return_value = None

        request = mock.MagicMock()
        request.body = json.dumps({'login': '******'})
        role_users = RoleUsersView()
        response = role_users.post(request, 'test-role')

        mock_resp.assert_called_once_with(None)
        self.assertTrue(response is mock_resp.return_value)
예제 #5
0
    def test_list_users_beloging_to_role(self, mock_fact, mock_resp):
        """
        Test list Users belonging to a role.
        """
        resp = {'login': '******', 'name': 'bar'}
        expected_cont = {'login': '******', 'name': 'bar'}

        mock_fact.user_query_manager.return_value.find_users_belonging_to_role.return_value = resp
        request = mock.MagicMock()
        role_users = RoleUsersView()
        response = role_users.get(request, 'test-role')

        mock_resp.assert_called_once_with(expected_cont)
        self.assertTrue(response is mock_resp.return_value)
예제 #6
0
파일: test_roles.py 프로젝트: alanoe/pulp
    def test_list_users_beloging_to_role(self, mock_ctrl, mock_fact, mock_resp):
        """
        Test list Users belonging to a role.
        """
        resp = {'login': '******', 'name': 'bar'}
        expected_cont = {'login': '******', 'name': 'bar'}

        mock_ctrl.find_users_belonging_to_role.return_value = resp
        request = mock.MagicMock()
        role_users = RoleUsersView()
        response = role_users.get(request, 'test-role')

        mock_resp.assert_called_once_with(expected_cont)
        self.assertTrue(response is mock_resp.return_value)
예제 #7
0
파일: urls.py 프로젝트: hgschmie/pulp
    url(r'^v2/repositories/(?P<repo_id>[^/]+)/distributors/(?P<distributor_id>[^/]+)/$',
        RepoDistributorResourceView.as_view(), name='repo_distributor_resource'),
    url(r'^v2/repositories/(?P<repo_id>[^/]+)/distributors/(?P<distributor_id>[^/]+)/schedules/publish/$',
        RepoPublishSchedulesView.as_view(), name='repo_publish_schedules'),
    url(r'^v2/repositories/(?P<repo_id>[^/]+)/distributors/(?P<distributor_id>[^/]+)/schedules/publish/(?P<schedule_id>[^/]+)/$',
        RepoPublishScheduleResourceView.as_view(), name='repo_publish_schedule_resource'),
    url(r'^v2/repositories/(?P<repo_id>[^/]+)/history/sync/$', RepoSyncHistory.as_view(),
        name='repo_sync_history'),
    url(r'^v2/repositories/(?P<repo_id>[^/]+)/history/publish/(?P<distributor_id>[^/]+)/$',
        RepoPublishHistory.as_view(), name='repo_publish_history'),
    url(r'^v2/repositories/(?P<repo_id>[^/]+)/actions/sync/$', RepoSync.as_view(),
        name='repo_sync'),
    url(r'^v2/repositories/(?P<repo_id>[^/]+)/actions/publish/$', RepoPublish.as_view(),
        name='repo_publish'),
    url(r'^v2/repositories/(?P<dest_repo_id>[^/]+)/actions/associate/$', RepoAssociate.as_view(),
        name='repo_associate'),
    url(r'^v2/repositories/(?P<repo_id>[^/]+)/actions/unassociate/$', RepoUnassociate.as_view(),
        name='repo_unassociate'),
    url(r'^v2/repositories/(?P<repo_id>[^/]+)/actions/import_upload/$', RepoImportUpload.as_view(),
        name='repo_import_upload'),
    url(r'^v2/roles/$', RolesView.as_view(), name='roles'),
    url(r'^v2/roles/(?P<role_id>[^/]+)/$', RoleResourceView.as_view(), name='role_resource'),
    url(r'^v2/roles/(?P<role_id>[^/]+)/users/$', RoleUsersView.as_view(), name='role_users'),
    url(r'^v2/roles/(?P<role_id>[^/]+)/users/(?P<login>[^/]+)/$', RoleUserView.as_view(), name='role_user'),
    url(r'^v2/status/$', StatusView.as_view(), name='status'),
    url(r'^v2/tasks/$', TaskCollectionView.as_view(), name='task_collection'),
    url(r'^v2/tasks/(?P<task_id>[^/]+)/$', TaskResourceView.as_view(), name='task_resource'),
    url(r'^v2/users/$', UsersView.as_view(), name='users'),
    url(r'^v2/users/(?P<login>[^/]+)/$', UserResourceView.as_view(), name='user_resource')
)
예제 #8
0
파일: urls.py 프로젝트: credativ/pulp
     name='repo_publish'),
 url(r'^v2/repositories/(?P<dest_repo_id>[^/]+)/actions/associate/$',
     RepoAssociate.as_view(),
     name='repo_associate'),
 url(r'^v2/repositories/(?P<repo_id>[^/]+)/actions/unassociate/$',
     RepoUnassociate.as_view(),
     name='repo_unassociate'),
 url(r'^v2/repositories/(?P<repo_id>[^/]+)/actions/import_upload/$',
     RepoImportUpload.as_view(),
     name='repo_import_upload'),
 url(r'^v2/roles/$', RolesView.as_view(), name='roles'),
 url(r'^v2/roles/(?P<role_id>[^/]+)/$',
     RoleResourceView.as_view(),
     name='role_resource'),
 url(r'^v2/roles/(?P<role_id>[^/]+)/users/$',
     RoleUsersView.as_view(),
     name='role_users'),
 url(r'^v2/roles/(?P<role_id>[^/]+)/users/(?P<login>[^/]+)/$',
     RoleUserView.as_view(),
     name='role_user'),
 url(r'^v2/status/$', StatusView.as_view(), name='status'),
 url(r'^v2/tasks/$',
     tasks.TaskCollectionView.as_view(),
     name='task_collection'),
 url(r'^v2/tasks/search/$',
     tasks.TaskSearchView.as_view(),
     name='task_search'),
 url(r'^v2/tasks/(?P<task_id>[^/]+)/$',
     tasks.TaskResourceView.as_view(),
     name='task_resource'),
 url(r'^v2/users/$', users.UsersView.as_view(), name='users'),
예제 #9
0
        RepoPublishSchedulesView.as_view(), name='repo_publish_schedules'),
    url(r'^v2/repositories/(?P<repo_id>[^/]+)/distributors/(?P<distributor_id>[^/]+)/schedules/publish/(?P<schedule_id>[^/]+)/$',
        RepoPublishScheduleResourceView.as_view(), name='repo_publish_schedule_resource'),
    url(r'^v2/repositories/(?P<repo_id>[^/]+)/history/sync/$', RepoSyncHistory.as_view(),
        name='repo_sync_history'),
    url(r'^v2/repositories/(?P<repo_id>[^/]+)/history/publish/(?P<distributor_id>[^/]+)/$',
        RepoPublishHistory.as_view(), name='repo_publish_history'),
    url(r'^v2/repositories/(?P<repo_id>[^/]+)/actions/sync/$', RepoSync.as_view(),
        name='repo_sync'),
    url(r'^v2/repositories/(?P<repo_id>[^/]+)/actions/publish/$', RepoPublish.as_view(),
        name='repo_publish'),
    url(r'^v2/repositories/(?P<dest_repo_id>[^/]+)/actions/associate/$', RepoAssociate.as_view(),
        name='repo_associate'),
    url(r'^v2/repositories/(?P<repo_id>[^/]+)/actions/unassociate/$', RepoUnassociate.as_view(),
        name='repo_unassociate'),
    url(r'^v2/repositories/(?P<repo_id>[^/]+)/actions/import_upload/$', RepoImportUpload.as_view(),
        name='repo_import_upload'),
    url(r'^v2/roles/$', RolesView.as_view(), name='roles'),
    url(r'^v2/roles/(?P<role_id>[^/]+)/$', RoleResourceView.as_view(), name='role_resource'),
    url(r'^v2/roles/(?P<role_id>[^/]+)/users/$', RoleUsersView.as_view(), name='role_users'),
    url(r'^v2/roles/(?P<role_id>[^/]+)/users/(?P<login>[^/]+)/$', RoleUserView.as_view(), name='role_user'),
    url(r'^v2/status/$', StatusView.as_view(), name='status'),
    url(r'^v2/tasks/$', tasks.TaskCollectionView.as_view(), name='task_collection'),
    url(r'^v2/tasks/search/$', tasks.TaskSearchView.as_view(), name='task_search'),
    url(r'^v2/tasks/(?P<task_id>[^/]+)/$', tasks.TaskResourceView.as_view(), name='task_resource'),
    url(r'^v2/users/$', users.UsersView.as_view(), name='users'),
    url(r'^v2/users/search/$', users.UserSearchView.as_view(),
        name='user_search'),
    url(r'^v2/users/(?P<login>[^/]+)/$', users.UserResourceView.as_view(), name='user_resource')
)