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

Method setUpTestData

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

Source from the content-addressed store, hash-verified

5139class AdminSearchTest(TestCase):
5140 @classmethod
5141 def setUpTestData(cls):
5142 cls.superuser = User.objects.create_superuser(
5143 username="super", password="secret", email="super@example.com"
5144 )
5145 cls.joepublicuser = User.objects.create_user(
5146 username="joepublic", password="secret"
5147 )
5148 cls.s1 = Section.objects.create(name="Test section")
5149 cls.a1 = Article.objects.create(
5150 content="<p>Middle content</p>",
5151 date=datetime.datetime(2008, 3, 18, 11, 54, 58),
5152 section=cls.s1,
5153 )
5154 cls.a2 = Article.objects.create(
5155 content="<p>Oldest content</p>",
5156 date=datetime.datetime(2000, 3, 18, 11, 54, 58),
5157 section=cls.s1,
5158 )
5159 cls.a3 = Article.objects.create(
5160 content="<p>Newest content</p>",
5161 date=datetime.datetime(2009, 3, 18, 11, 54, 58),
5162 section=cls.s1,
5163 )
5164 cls.p1 = PrePopulatedPost.objects.create(
5165 title="A Long Title", published=True, slug="a-long-title"
5166 )
5167
5168 cls.per1 = Person.objects.create(name="John Mauchly", gender=1, alive=True)
5169 cls.per2 = Person.objects.create(name="Grace Hopper", gender=1, alive=False)
5170 cls.per3 = Person.objects.create(name="Guido van Rossum", gender=1, alive=True)
5171 Person.objects.create(name="John Doe", gender=1)
5172 Person.objects.create(name='John O"Hara', gender=1)
5173 Person.objects.create(name="John O'Hara", gender=1)
5174
5175 cls.t1 = Recommender.objects.create()
5176 cls.t2 = Recommendation.objects.create(the_recommender=cls.t1)
5177 cls.t3 = Recommender.objects.create()
5178 cls.t4 = Recommendation.objects.create(the_recommender=cls.t3)
5179
5180 cls.tt1 = TitleTranslation.objects.create(title=cls.t1, text="Bar")
5181 cls.tt2 = TitleTranslation.objects.create(title=cls.t2, text="Foo")
5182 cls.tt3 = TitleTranslation.objects.create(title=cls.t3, text="Few")
5183 cls.tt4 = TitleTranslation.objects.create(title=cls.t4, text="Bas")
5184
5185 def setUp(self):
5186 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