-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transfer hotfix django-storages (#1517)
* Revert "Revert "S1158 - Nom des documents téléchargés (#1478)" (#1512)" This reverts commit 91ac6d2. * Revert "Bump django-storages from 1.14.3 to 1.14.4 (#1500)" This reverts commit 5f190d0.
- Loading branch information
Showing
6 changed files
with
117 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import time_machine | ||
from django.test import SimpleTestCase | ||
from unittest_parametrize import ParametrizedTestCase, parametrize | ||
|
||
from conventions.models import ConventionStatut | ||
from conventions.services.utils import convention_upload_filename | ||
from conventions.tests.factories import ConventionFactory | ||
|
||
|
||
class UtilsTest(ParametrizedTestCase, SimpleTestCase): | ||
|
||
@parametrize( | ||
"conv_data, expected_result", | ||
[ | ||
( | ||
{ | ||
"numero": "123/456/789", | ||
}, | ||
"convention_123/456/789_projet_2024-06-21_00-00.pdf", | ||
), | ||
( | ||
{ | ||
"numero": None, | ||
}, | ||
"convention_NUM_projet_2024-06-21_00-00.pdf", | ||
), | ||
( | ||
{ | ||
"numero": "", | ||
}, | ||
"convention_NUM_projet_2024-06-21_00-00.pdf", | ||
), | ||
( | ||
{ | ||
"numero": "123 456 789", | ||
"statut": ConventionStatut.INSTRUCTION.label, | ||
}, | ||
"convention_123_456_789_2024-06-21_00-00.pdf", | ||
), | ||
( | ||
{ | ||
"numero": "1", | ||
"parent": ConventionFactory.build(numero="123/456/789"), | ||
}, | ||
"convention_123/456/789_avenant_1_projet_2024-06-21_00-00.pdf", | ||
), | ||
( | ||
{ | ||
"numero": None, | ||
"parent": ConventionFactory.build(numero="123/456/789"), | ||
}, | ||
"convention_123/456/789_avenant_N_projet_2024-06-21_00-00.pdf", | ||
), | ||
( | ||
{ | ||
"numero": "", | ||
"parent": ConventionFactory.build(numero="123/456/789"), | ||
}, | ||
"convention_123/456/789_avenant_N_projet_2024-06-21_00-00.pdf", | ||
), | ||
], | ||
) | ||
def test_convention_upload_filename(self, conv_data, expected_result): | ||
with time_machine.travel("2024-06-21"): | ||
assert ( | ||
convention_upload_filename( | ||
convention=ConventionFactory.build(**conv_data) | ||
) | ||
== expected_result | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters