mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-09 09:58:20 -05:00
Add missing storage path placeholders
This commit is contained in:
parent
3e777f2a5b
commit
add647afe6
@ -599,11 +599,17 @@ class StoragePathSerializer(MatchingModelSerializer):
|
|||||||
document_type="document_type",
|
document_type="document_type",
|
||||||
created="created",
|
created="created",
|
||||||
created_year="created_year",
|
created_year="created_year",
|
||||||
|
created_year_short="created_year_short",
|
||||||
created_month="created_month",
|
created_month="created_month",
|
||||||
|
created_month_name="created_month_name",
|
||||||
|
created_month_name_short="created_month_name_short",
|
||||||
created_day="created_day",
|
created_day="created_day",
|
||||||
added="added",
|
added="added",
|
||||||
added_year="added_year",
|
added_year="added_year",
|
||||||
|
added_year_short="added_year_short",
|
||||||
added_month="added_month",
|
added_month="added_month",
|
||||||
|
added_month_name="added_month_name",
|
||||||
|
added_month_name_short="added_month_name_short",
|
||||||
added_day="added_day",
|
added_day="added_day",
|
||||||
asn="asn",
|
asn="asn",
|
||||||
tags="tags",
|
tags="tags",
|
||||||
|
@ -3199,6 +3199,30 @@ class TestApiStoragePaths(DirectoriesMixin, APITestCase):
|
|||||||
self.assertEqual(response.status_code, 400)
|
self.assertEqual(response.status_code, 400)
|
||||||
self.assertEqual(StoragePath.objects.count(), 1)
|
self.assertEqual(StoragePath.objects.count(), 1)
|
||||||
|
|
||||||
|
def test_api_storage_path_placeholders(self):
|
||||||
|
"""
|
||||||
|
GIVEN:
|
||||||
|
- API request to create a storage path with placeholders
|
||||||
|
- Storage path is valid
|
||||||
|
WHEN:
|
||||||
|
- API is called
|
||||||
|
THEN:
|
||||||
|
- Correct HTTP response
|
||||||
|
- New storage path is created
|
||||||
|
"""
|
||||||
|
response = self.client.post(
|
||||||
|
self.ENDPOINT,
|
||||||
|
json.dumps(
|
||||||
|
{
|
||||||
|
"name": "Storage path with placeholders",
|
||||||
|
"path": "{title}/{correspondent}/{document_type}/{created}/{created_year}/{created_year_short}/{created_month}/{created_month_name}/{created_month_name_short}/{created_day}/{added}/{added_year}/{added_year_short}/{added_month}/{added_month_name}/{added_month_name_short}/{added_day}/{asn}/{tags}/{tag_list}/",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
content_type="application/json",
|
||||||
|
)
|
||||||
|
self.assertEqual(response.status_code, 201)
|
||||||
|
self.assertEqual(StoragePath.objects.count(), 2)
|
||||||
|
|
||||||
|
|
||||||
class TestTasks(DirectoriesMixin, APITestCase):
|
class TestTasks(DirectoriesMixin, APITestCase):
|
||||||
ENDPOINT = "/api/tasks/"
|
ENDPOINT = "/api/tasks/"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user