Skip to content

Commit

Permalink
Fix Drag and drop in Appraisal tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhwaniartefact committed Oct 30, 2023
1 parent 110c84d commit e7bf026
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/dashboard/src/components/filesystem_ajax/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,6 @@ def _copy_files_to_arrange(
):
sourcepath = sourcepath.lstrip("/") # starts with 'originals/', not '/originals/'
# Insert each file into the DB

# Lots of error checking:
if not sourcepath or not destination:
raise ValueError(_("GET parameter 'filepath' or 'destination' was blank."))
Expand Down
49 changes: 49 additions & 0 deletions src/dashboard/tests/test_filesystem_ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,55 @@ def test_move_within_arrange(self):
assert b64encode_string("newsip") in response_dict["entries"]
assert len(response_dict["entries"]) == 2

@mock.patch(
"storageService.get_first_location",
return_value={"uuid": "355d110f-b641-4b6b-b1c0-8426e63951e5"},
)
@mock.patch(
"storageService.get_file_metadata",
side_effect=[
[
{
"fileuuid": "0b603cee-1f8a-4842-996a-e02a0307ccf7",
"sipuuid": "99c87143-6f74-4398-84e0-14a8ca4bd05a",
}
],
[
{
"fileuuid": "03a33ef5-8714-46cc-aefe-7283186341ca",
"sipuuid": "4ae7b624-9ba7-452a-adbc-1588223b7098",
}
],
],
)
@mock.patch(
"storageService.browse_location",
return_value={
"directories": [],
"entries": ["error.txt", "tree_a.txt"],
"properties": {
"error.txt": {"size": 8},
"tree_a.txt": {"size": 6},
},
},
)
def test_copy_within_arrange(
self, browse_location, get_file_metadata, get_first_location
):
# Copy directory
response = self.client.post(
reverse("filesystem_ajax:copy_to_arrange"),
data={
"filepath": b64encode_string("/originals/objects/"),
"destination": b64encode_string("/arrange/"),
},
follow=True,
)
assert response.status_code == 201
assert json.loads(response.content.decode("utf8")) == {
"message": "Files added to the SIP."
}

def test_copy_from_arrange_to_completed(self):
sip_uuid = "a29e7e86-eca9-43b6-b059-6f23a9802dc8"
models.SIP.objects.create(uuid=sip_uuid)
Expand Down

0 comments on commit e7bf026

Please sign in to comment.