diff options
| author | Mykola Kokalko <jajcee@gmail.com> | 2019-05-02 10:42:10 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-05-02 11:11:56 +0200 |
| commit | ef082ebb84f00e38af4e8880d04e8365c2766d34 (patch) | |
| tree | 1b6d22c787dafd5cd06615511a724216fad221bf /tests/model_fields | |
| parent | 11971cd87c6cb208325d28ddf7e663dadde77d68 (diff) | |
Fixed #29529 -- Allowed models.fields.FilePathField to accept a callable path.
Diffstat (limited to 'tests/model_fields')
| -rw-r--r-- | tests/model_fields/test_filepathfield.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/model_fields/test_filepathfield.py b/tests/model_fields/test_filepathfield.py index d5d43ff6f6..362d12d0db 100644 --- a/tests/model_fields/test_filepathfield.py +++ b/tests/model_fields/test_filepathfield.py @@ -10,3 +10,13 @@ class FilePathFieldTests(SimpleTestCase): field = FilePathField(path=path) self.assertEqual(field.path, path) self.assertEqual(field.formfield().path, path) + + def test_callable_path(self): + path = os.path.dirname(__file__) + + def generate_path(): + return path + + field = FilePathField(path=generate_path) + self.assertEqual(field.path(), path) + self.assertEqual(field.formfield().path, path) |
