MCPcopy
hub / github.com/django/django / test_basic

Method test_basic

tests/sites_tests/tests.py:279–292  ·  view source on GitHub ↗

#15346, #15573 - create_default_site() creates an example site only if none exist.

(self)

Source from the content-addressed store, hash-verified

277 self.app_config = apps.get_app_config("sites")
278
279 def test_basic(self):
280 """
281 #15346, #15573 - create_default_site() creates an example site only if
282 none exist.
283 """
284 with captured_stdout() as stdout:
285 create_default_site(self.app_config)
286 self.assertEqual(Site.objects.count(), 1)
287 self.assertIn("Creating example.com", stdout.getvalue())
288
289 with captured_stdout() as stdout:
290 create_default_site(self.app_config)
291 self.assertEqual(Site.objects.count(), 1)
292 self.assertEqual("", stdout.getvalue())
293
294 @override_settings(DATABASE_ROUTERS=[JustOtherRouter()])
295 def test_multi_db_with_router(self):

Callers

nothing calls this directly

Calls 4

captured_stdoutFunction · 0.90
create_default_siteFunction · 0.90
countMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected