コード例 #1
0
 def get_file(deposit, file_access):
     with app.test_client() as client:
         if user is not None:
             login_user(user, client)
         subtest_file_bucket_permissions(client,
                                         deposit.files.bucket,
                                         access_level=file_access,
                                         is_authenticated=user
                                         is not None)
コード例 #2
0
 def get_file(deposit, file_access):
     with app.test_client() as client:
         if user is not None:
             login_user(user, client)
         subtest_file_bucket_permissions(
             client, deposit.files.bucket,
             access_level=file_access,
             is_authenticated=user is not None
         )
コード例 #3
0
 def check_embargo(record_id, is_embargoed):
     with app.app_context():
         with app.test_client() as client:
             login_user(non_creator, client)
             # test open_access field in record's metadata
             record = Record.get_record(record_id)
             assert record['open_access'] != is_embargoed
             # test record's file access
             subtest_file_bucket_permissions(
                 client,
                 record.files.bucket,
                 access_level=None if is_embargoed else 'read',
                 is_authenticated=True)
コード例 #4
0
 def check_embargo(record_id, is_embargoed):
     with app.app_context():
         with app.test_client() as client:
             login_user(non_creator, client)
             # test open_access field in record's metadata
             record = Record.get_record(record_id)
             assert record['open_access'] != is_embargoed
             # test record's file access
             subtest_file_bucket_permissions(
                 client, record.files.bucket,
                 access_level=None if is_embargoed else 'read',
                 is_authenticated=True
             )
コード例 #5
0
        def test_get(pid, record, status, user=None, files_access=None):
            with app.test_client() as client:
                if user is not None:
                    login_user(user, client)
                headers = [('Accept', 'application/json')]
                request_res = client.get(
                    url_for('b2share_records_rest.b2rec_item',
                            pid_value=pid.pid_value),
                    headers=headers)

                request_data = json.loads(
                    request_res.get_data(as_text=True))

                assert request_res.status_code == status

                # check that the permissions to the file bucket is correct
                subtest_file_bucket_permissions(
                    client, record.files.bucket, access_level=files_access,
                    is_authenticated=user is not None
                )
コード例 #6
0
        def test_get(pid, record, status, user=None, files_access=None):
            with app.test_client() as client:
                if user is not None:
                    login_user(user, client)
                headers = [('Accept', 'application/json')]
                request_res = client.get(
                    url_for('b2share_records_rest.b2rec_item',
                            pid_value=pid.pid_value),
                    headers=headers)

                request_data = json.loads(
                    request_res.get_data(as_text=True))

                assert request_res.status_code == status

                # check that the permissions to the file bucket is correct
                subtest_file_bucket_permissions(
                    client, record.files.bucket, access_level=files_access,
                    is_authenticated=user is not None
                )