diff options
| author | abhiabhi94 <13880786+abhiabhi94@users.noreply.github.com> | 2021-07-01 12:58:02 +0530 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-07-01 12:42:32 +0200 |
| commit | fde6fb28984a76d5bee794f4c0458eb25fe56fcd (patch) | |
| tree | 9f21e5d4c9c5012f027528d82eb5f2d86f393bad /tests | |
| parent | 36fa071d6ebd18a61c4d7f1b5c9d17106134bd44 (diff) | |
Fixed #32893 -- Fixed serialization of models.Model class in migrations.
Migrations assumed that an import of the models.Model class must
already be included when it's serialized, but for models with only
custom fields this was not necessarily the case.
Thanks Jaap Joris Vens for the report.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/migrations/test_writer.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py index a590ff4398..471194ffc2 100644 --- a/tests/migrations/test_writer.py +++ b/tests/migrations/test_writer.py @@ -658,6 +658,13 @@ class WriterTests(SimpleTestCase): def test_serialize_type_none(self): self.assertSerializedEqual(type(None)) + def test_serialize_type_model(self): + self.assertSerializedEqual(models.Model) + self.assertSerializedResultEqual( + MigrationWriter.serialize(models.Model), + ("('models.Model', {'from django.db import models'})", set()), + ) + def test_simple_migration(self): """ Tests serializing a simple migration. |
