Skip to content

Commit cdb8810

Browse files
authored
Merge pull request #1110 from ryoya-hayase/feature/W2025-28
Address review comments
2 parents a56fcff + 54bd925 commit cdb8810

17 files changed

Lines changed: 50 additions & 44 deletions

test/tavern/create_item_type_template.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ def create_itemtype_template():
3535
# Create template for entering data
3636
template = create_template(result['schema'])
3737
template['$schema'] = '/items/jsonschema/' + str(schema[0])
38-
template['shared_user_id'] = -1
38+
template['shared_user_ids'] = []
3939
with open('request_params/item_type_template/template/' + file_name + '.json', 'w', encoding='utf-8') as f:
4040
f.write(json.dumps(template, indent=4, ensure_ascii=False))
4141

4242
# Create template for generating random data
4343
random_template, _ = create_random_template(result['schema'])
4444
random_template['$schema'] = '/items/jsonschema/' + str(schema[0])
45-
random_template['shared_user_id'] = -1
45+
random_template['shared_user_ids'] = []
4646
with open('request_params/item_type_template/template/' + file_name + '_random.json', 'w', encoding='utf-8') as f:
4747
f.write(json.dumps(random_template, indent=4, ensure_ascii=False))
4848

test/tavern/helper/common/request_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def request_create_deposits_redirect_param(data, title_key, file_metadata=None):
134134
$schema (str): schema
135135
lang (str): lang
136136
pubdate (str): publish date
137-
shared_user_id (int): shared user id
137+
shared_user_ids (list): shared user ids
138138
title (str): title
139139
[key] (list or dict): item data with value
140140
deleted_items (list): item keys with no value

test/tavern/helper/config.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
DATABASE = {
2-
'host': 'localhost',
3-
'port': 25401,
4-
'dbname': 'invenio',
5-
'user': 'invenio',
6-
'password': 'dbpass123'
2+
'host': 'localhost',
3+
'port': 25401,
4+
'dbname': 'invenio',
5+
'user': 'invenio',
6+
'password': 'dbpass123'
77
}
88

99
REDIS = {
10-
'host': 'localhost',
11-
'port': 26301,
12-
'db': 0
10+
'host': 'localhost',
11+
'port': 26301,
12+
'db': 0
1313
}
1414

1515
USERS = {
16-
'sysadmin': {
17-
'email': 'wekosoftware@nii.ac.jp',
18-
'password': 'uspass123'
19-
},
20-
'repoadmin': {
21-
'email': 'repoadmin@example.org',
22-
'password': 'uspass123'
23-
},
24-
'comadmin': {
25-
'email': 'comadmin@example.org',
26-
'password': 'uspass123'
27-
},
28-
'contributor': {
29-
'email': 'contributor@example.org',
30-
'password': 'uspass123'
31-
},
32-
'user': {
33-
'email': 'user@example.org',
34-
'password': 'uspass123'
35-
}
16+
'sysadmin': {
17+
'email': 'wekosoftware@nii.ac.jp',
18+
'password': 'uspass123'
19+
},
20+
'repoadmin': {
21+
'email': 'repoadmin@example.org',
22+
'password': 'uspass123'
23+
},
24+
'comadmin': {
25+
'email': 'comadmin@example.org',
26+
'password': 'uspass123'
27+
},
28+
'contributor': {
29+
'email': 'contributor@example.org',
30+
'password': 'uspass123'
31+
},
32+
'user': {
33+
'email': 'user@example.org',
34+
'password': 'uspass123'
35+
}
3636
}
3737

3838
REPLACEMENT_DECISION_STRING = {

test/tavern/helper/index/verify_helper.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ def verify_index_tree(
9292
expected_tree_file,
9393
role_id,
9494
edited_id_list=None,
95-
deleted_id_list=None
95+
deleted_id_list=None,
96+
no_action=False
9697
):
9798
"""Verify the index tree structure in the response.
9899
@@ -102,6 +103,7 @@ def verify_index_tree(
102103
role_id(str): Role ID to filter the tree information.
103104
edited_id_list(list, optional): List of IDs of the edited index nodes. Defaults to None.
104105
deleted_id_list(list, optional): List of IDs of the deleted index nodes. Defaults to None.
106+
no_action(bool, optional): Flag to indicate no action. Defaults to False.
105107
106108
Raises:
107109
ValueError: If an edited index ID is not found in the database.
@@ -176,7 +178,7 @@ def delete_node(tree, my_id):
176178

177179
with open(expected_tree_file, 'r') as f:
178180
expected_tree = json.load(f)
179-
if role_id not in [1, 2, 3, 4]:
181+
if role_id not in [1, 2] and not no_action:
180182
browsing_tree = get_browsing_treeinfo(expected_tree, role_id)
181183
else:
182184
browsing_tree = expected_tree

test/tavern/prepare_data/execute_order.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ communities_community.sql
1313
oaiserver_schema.sql
1414
pdfcoverpage_set.sql
1515
oaiserver_identify.sql
16+
files_bucket.sql
17+
oaiserver_set.sql

test/tavern/request_params/item_type_30002_invalid_choice.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
"resourcetype": "no resource type"
1212
},
1313
"$schema": "/items/jsonschema/30002",
14-
"shared_user_id": -1
14+
"shared_user_ids": []
1515
}

test/tavern/request_params/item_type_30002_no_required.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
}
88
],
99
"$schema": "/items/jsonschema/30002",
10-
"shared_user_id": -1
10+
"shared_user_ids": []
1111
}

test/tavern/request_params/item_type_template/template/item_type_10001.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,5 +322,5 @@
322322
}
323323
],
324324
"$schema": "/items/jsonschema/10001",
325-
"shared_user_id": -1
325+
"shared_user_ids": []
326326
}

test/tavern/request_params/item_type_template/template/item_type_10001_random.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1666,5 +1666,5 @@
16661666
"max": 5
16671667
},
16681668
"$schema": "/items/jsonschema/10001",
1669-
"shared_user_id": -1
1669+
"shared_user_ids": []
16701670
}

test/tavern/request_params/item_type_template/template/item_type_30001.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,5 +343,5 @@
343343
"bibliographicNumberOfPages": ""
344344
},
345345
"$schema": "/items/jsonschema/30001",
346-
"shared_user_id": -1
346+
"shared_user_ids": []
347347
}

0 commit comments

Comments
 (0)