Пример #1
0
    def test_not_change_contributor(self, app, user, contrib, project,
                                    url_contrib):
        with assert_latest_log_not(NodeLog.PERMISSIONS_UPDATED, project):
            contrib_id = '{}-{}'.format(project._id, contrib._id)
            data = {
                'data': {
                    'id': contrib_id,
                    'type': 'contributors',
                    'attributes': {
                        'permission': None,
                        'bibliographic': True
                    }
                }
            }
            res = app.put_json_api(url_contrib, data, auth=user.auth)
            assert res.status_code == 200
            attributes = res.json['data']['attributes']
            assert attributes['permission'] == permissions.WRITE
            assert attributes['bibliographic']

            project.reload()
            assert project.get_permissions(contrib) == [
                permissions.READ, permissions.WRITE
            ]
            assert project.get_visible(contrib)
    def test_not_change_contributor(
            self, app, user, contrib, project, url_contrib):
        with assert_latest_log_not(NodeLog.PERMISSIONS_UPDATED, project):
            contrib_id = '{}-{}'.format(project._id, contrib._id)
            data = {
                'data': {
                    'id': contrib_id,
                    'type': 'contributors',
                    'attributes': {
                        'permission': None,
                        'bibliographic': True
                    }
                }
            }
            res = app.put_json_api(url_contrib, data, auth=user.auth)
            assert res.status_code == 200
            attributes = res.json['data']['attributes']
            assert attributes['permission'] == permissions.WRITE
            assert attributes['bibliographic']

            project.reload()
            assert project.get_permissions(contrib) == [
                permissions.READ, permissions.WRITE]
            assert project.get_visible(contrib)