MCPcopy
hub / github.com/django/django / test_files_content

Method test_files_content

tests/migrations/test_commands.py:1645–1671  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1643 super().tearDown()
1644
1645 def test_files_content(self):
1646 self.assertTableNotExists("migrations_unicodemodel")
1647 apps.register_model("migrations", UnicodeModel)
1648 with self.temporary_migration_module() as migration_dir:
1649 call_command("makemigrations", "migrations", verbosity=0)
1650
1651 # Check for empty __init__.py file in migrations folder
1652 init_file = os.path.join(migration_dir, "__init__.py")
1653 self.assertTrue(os.path.exists(init_file))
1654
1655 with open(init_file) as fp:
1656 content = fp.read()
1657 self.assertEqual(content, "")
1658
1659 # Check for existing 0001_initial.py file in migration folder
1660 initial_file = os.path.join(migration_dir, "0001_initial.py")
1661 self.assertTrue(os.path.exists(initial_file))
1662
1663 with open(initial_file, encoding="utf-8") as fp:
1664 content = fp.read()
1665 self.assertIn("migrations.CreateModel", content)
1666 self.assertIn("initial = True", content)
1667
1668 self.assertIn("úñí©óðé µóðéø", content) # Meta.verbose_name
1669 self.assertIn("úñí©óðé µóðéøß", content) # Meta.verbose_name_plural
1670 self.assertIn("ÚÑÍ¢ÓÐÉ", content) # title.verbose_name
1671 self.assertIn("“Ðjáñgó”", content) # title.default
1672
1673 def test_makemigrations_order(self):
1674 """

Callers

nothing calls this directly

Calls 7

call_commandFunction · 0.90
assertTableNotExistsMethod · 0.45
register_modelMethod · 0.45
joinMethod · 0.45
existsMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected