Add a test that OneToOneField is detected by inspectdb in Django >= 3.0
@@ -7,6 +7,8 @@ from typing import Dict
import os
import re
import unittest
+from salesforce.backend import DJANGO_30_PLUS
+from salesforce.backend.test_helpers import expectedFailureIf
def relative_path(path: str) -> str:
@@ -84,6 +86,11 @@ class ExportedModelTest(unittest.TestCase):
line = self.match_line(' created_by = ', classes_texts['Opportunity'])
self.assertNotIn('Master Detail Relationship', line)
+ @expectedFailureIf(not DJANGO_30_PLUS)
+ def test_one_to_one_field_introspection(self) -> None:
+ """Test that OneToOneField is correctly introspected"""
+ self.assertTrue(any(('= models.OneToOneField(' in text) for text in classes_texts.values()))
+
classes_texts = get_classes_texts()
