MCPcopy
hub / github.com/django/django / test_creation_with_db_table_double_quotes

Method test_creation_with_db_table_double_quotes

tests/schema/tests.py:5582–5610  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5580 connection.vendor == "oracle", "Oracle specific db_table syntax"
5581 )
5582 def test_creation_with_db_table_double_quotes(self):
5583 oracle_user = connection.creation._test_database_user()
5584
5585 class Student(Model):
5586 name = CharField(max_length=30)
5587
5588 class Meta:
5589 app_label = "schema"
5590 apps = new_apps
5591 db_table = '"%s"."DJANGO_STUDENT_TABLE"' % oracle_user
5592
5593 class Document(Model):
5594 name = CharField(max_length=30)
5595 students = ManyToManyField(Student)
5596
5597 class Meta:
5598 app_label = "schema"
5599 apps = new_apps
5600 db_table = '"%s"."DJANGO_DOCUMENT_TABLE"' % oracle_user
5601
5602 self.isolated_local_models = [Student, Document]
5603
5604 with connection.schema_editor() as editor:
5605 editor.create_model(Student)
5606 editor.create_model(Document)
5607
5608 doc = Document.objects.create(name="Test Name")
5609 student = Student.objects.create(name="Some man")
5610 doc.students.add(student)
5611
5612 @isolate_apps("schema")
5613 @unittest.skipUnless(

Callers

nothing calls this directly

Calls 5

_test_database_userMethod · 0.80
schema_editorMethod · 0.80
create_modelMethod · 0.45
createMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected