mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Allow any sub-items to be moved from a folder
Since you can now see them when searching you should also be able to select and move them. Which means that they needed to be included in the `Form`’s list of possible choices of things to move.
This commit is contained in:
@@ -378,7 +378,11 @@ def test_should_show_templates_folder_page(
|
||||
assert links_in_page[index].text.strip() == expected_link
|
||||
|
||||
all_page_items = page.select('.template-list-item')
|
||||
checkboxes = page.select('input[name=templates_and_folders]')
|
||||
unique_checkbox_values = set(item['value'] for item in checkboxes)
|
||||
assert len(all_page_items) == len(expected_items)
|
||||
assert len(checkboxes) == len(expected_items)
|
||||
assert len(unique_checkbox_values) == len(expected_items)
|
||||
|
||||
for index, expected_item in enumerate(expected_items):
|
||||
assert normalize_spaces(all_page_items[index].text) == expected_item
|
||||
|
||||
@@ -365,6 +365,40 @@ def test_should_post_move_to_api(
|
||||
)
|
||||
|
||||
|
||||
def test_should_be_able_to_move_a_sub_item(
|
||||
client_request,
|
||||
service_one,
|
||||
fake_uuid,
|
||||
mock_get_service_templates,
|
||||
mock_get_template_folders,
|
||||
mock_move_to_template_folder,
|
||||
):
|
||||
service_one['permissions'] += ['edit_folders']
|
||||
GRANDCHILD_FOLDER_ID = str(uuid.uuid4())
|
||||
mock_get_template_folders.return_value = [
|
||||
{'id': PARENT_FOLDER_ID, 'name': 'folder_one', 'parent_id': None},
|
||||
{'id': CHILD_FOLDER_ID, 'name': 'folder_one_one', 'parent_id': PARENT_FOLDER_ID},
|
||||
{'id': GRANDCHILD_FOLDER_ID, 'name': 'folder_one_one_one', 'parent_id': CHILD_FOLDER_ID},
|
||||
]
|
||||
client_request.post(
|
||||
'main.choose_template',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
template_folder_id=PARENT_FOLDER_ID,
|
||||
_data={
|
||||
'operation': 'move',
|
||||
'move_to': 'None',
|
||||
'templates_and_folders': [GRANDCHILD_FOLDER_ID],
|
||||
},
|
||||
_expected_status=302,
|
||||
)
|
||||
mock_move_to_template_folder.assert_called_once_with(
|
||||
service_id=SERVICE_ONE_ID,
|
||||
folder_id=None,
|
||||
folder_ids={GRANDCHILD_FOLDER_ID},
|
||||
template_ids=set(),
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('thing_to_move', [
|
||||
PARENT_FOLDER_ID, # Can’t move a folder inside itself
|
||||
CHILD_FOLDER_ID, # Can’t move a folder which doesn’t belong to the service
|
||||
|
||||
Reference in New Issue
Block a user