Feature: live preview of storage path (#7870)

This commit is contained in:
shamoon
2024-10-09 16:35:36 -07:00
committed by GitHub
parent 8dd355f6bf
commit 024b60638a
15 changed files with 426 additions and 54 deletions

View File

@@ -306,6 +306,35 @@ class TestApiStoragePaths(DirectoriesMixin, APITestCase):
# only called once
bulk_update_mock.assert_called_once_with([document.pk])
def test_test_storage_path(self):
"""
GIVEN:
- API request to test a storage path
WHEN:
- API is called
THEN:
- Correct HTTP response
- Correct response data
"""
document = Document.objects.create(
mime_type="application/pdf",
storage_path=self.sp1,
title="Something",
checksum="123",
)
response = self.client.post(
f"{self.ENDPOINT}test/",
json.dumps(
{
"document": document.id,
"path": "path/{{ title }}",
},
),
content_type="application/json",
)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data, "path/Something")
class TestBulkEditObjects(APITestCase):
# See test_api_permissions.py for bulk tests on permissions