|
14 | 14 |
|
15 | 15 | from simple_history.models import ( |
16 | 16 | HistoricalRecords, |
17 | | - convert_auto_field, |
18 | 17 | ModelChange |
19 | 18 | ) |
20 | 19 | from simple_history.utils import update_change_reason |
@@ -778,44 +777,6 @@ def test_state_serialization_of_customfk(self): |
778 | 777 | state.ModelState.from_model(HistoricalCustomFKError) |
779 | 778 |
|
780 | 779 |
|
781 | | -class TestConvertAutoField(TestCase): |
782 | | - """Check what AutoFields get converted to.""" |
783 | | - |
784 | | - def setUp(self): |
785 | | - for field in Poll._meta.fields: |
786 | | - if isinstance(field, models.AutoField): |
787 | | - self.field = field |
788 | | - break |
789 | | - |
790 | | - def test_relational(self): |
791 | | - """Relational test |
792 | | -
|
793 | | - Default Django ORM uses an integer-based auto field. |
794 | | - """ |
795 | | - with warnings.catch_warnings(): |
796 | | - warnings.filterwarnings('ignore', category=UserWarning, |
797 | | - message='Overriding setting DATABASES ' + |
798 | | - 'can lead to unexpected behavior.') |
799 | | - with self.settings(DATABASES={'default': { |
800 | | - 'ENGINE': 'django.db.backends.postgresql_psycopg2'}}): |
801 | | - assert convert_auto_field(self.field) == models.IntegerField |
802 | | - |
803 | | - def test_non_relational(self): |
804 | | - """Non-relational test |
805 | | -
|
806 | | - MongoDB uses a string-based auto field. We need to make sure |
807 | | - the converted field type is string. |
808 | | - """ |
809 | | - |
810 | | - with warnings.catch_warnings(): |
811 | | - warnings.filterwarnings('ignore', category=UserWarning, |
812 | | - message='Overriding setting DATABASES ' + |
813 | | - 'can lead to unexpected behavior.') |
814 | | - with self.settings(DATABASES={'default': { |
815 | | - 'ENGINE': 'django_mongodb_engine'}}): |
816 | | - assert convert_auto_field(self.field) == models.TextField |
817 | | - |
818 | | - |
819 | 780 | class TestOrderWrtField(TestCase): |
820 | 781 | """Check behaviour of _order field added by Meta.order_with_respect_to. |
821 | 782 |
|
|
0 commit comments