MCPcopy
hub / github.com/django/django / setUpTestData

Method setUpTestData

tests/admin_views/tests.py:3939–3989  ·  view source on GitHub ↗
(cls)

Source from the content-addressed store, hash-verified

3937class AdminViewDeletedObjectsTest(TestCase):
3938 @classmethod
3939 def setUpTestData(cls):
3940 cls.superuser = User.objects.create_superuser(
3941 username="super", password="secret", email="super@example.com"
3942 )
3943 cls.deleteuser = User.objects.create_user(
3944 username="deleteuser", password="secret", is_staff=True
3945 )
3946 cls.s1 = Section.objects.create(name="Test section")
3947 cls.a1 = Article.objects.create(
3948 content="<p>Middle content</p>",
3949 date=datetime.datetime(2008, 3, 18, 11, 54, 58),
3950 section=cls.s1,
3951 )
3952 cls.a2 = Article.objects.create(
3953 content="<p>Oldest content</p>",
3954 date=datetime.datetime(2000, 3, 18, 11, 54, 58),
3955 section=cls.s1,
3956 )
3957 cls.a3 = Article.objects.create(
3958 content="<p>Newest content</p>",
3959 date=datetime.datetime(2009, 3, 18, 11, 54, 58),
3960 section=cls.s1,
3961 )
3962 cls.p1 = PrePopulatedPost.objects.create(
3963 title="A Long Title", published=True, slug="a-long-title"
3964 )
3965
3966 cls.v1 = Villain.objects.create(name="Adam")
3967 cls.v2 = Villain.objects.create(name="Sue")
3968 cls.sv1 = SuperVillain.objects.create(name="Bob")
3969 cls.pl1 = Plot.objects.create(
3970 name="World Domination", team_leader=cls.v1, contact=cls.v2
3971 )
3972 cls.pl2 = Plot.objects.create(
3973 name="World Peace", team_leader=cls.v2, contact=cls.v2
3974 )
3975 cls.pl3 = Plot.objects.create(
3976 name="Corn Conspiracy", team_leader=cls.v1, contact=cls.v1
3977 )
3978 cls.pd1 = PlotDetails.objects.create(details="almost finished", plot=cls.pl1)
3979 cls.sh1 = SecretHideout.objects.create(
3980 location="underground bunker", villain=cls.v1
3981 )
3982 cls.sh2 = SecretHideout.objects.create(
3983 location="floating castle", villain=cls.sv1
3984 )
3985 cls.ssh1 = SuperSecretHideout.objects.create(
3986 location="super floating castle!", supervillain=cls.sv1
3987 )
3988 cls.cy1 = CyclicOne.objects.create(pk=1, name="I am recursive", two_id=1)
3989 cls.cy2 = CyclicTwo.objects.create(pk=1, name="I am recursive too", one_id=1)
3990
3991 def setUp(self):
3992 self.client.force_login(self.superuser)

Callers

nothing calls this directly

Calls 3

create_superuserMethod · 0.45
create_userMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected