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

Method setUpTestData

tests/serializers/tests.py:110–132  ·  view source on GitHub ↗
(cls)

Source from the content-addressed store, hash-verified

108
109 @classmethod
110 def setUpTestData(cls):
111 sports = Category.objects.create(name="Sports")
112 music = Category.objects.create(name="Music")
113 op_ed = Category.objects.create(name="Op-Ed")
114
115 cls.joe = Author.objects.create(name="Joe")
116 cls.jane = Author.objects.create(name="Jane")
117
118 cls.a1 = Article(
119 author=cls.jane,
120 headline="Poker has no place on ESPN",
121 pub_date=datetime(2006, 6, 16, 11, 00),
122 )
123 cls.a1.save()
124 cls.a1.categories.set([sports, op_ed])
125
126 cls.a2 = Article(
127 author=cls.joe,
128 headline="Time to reform copyright",
129 pub_date=datetime(2006, 6, 16, 13, 00, 11, 345),
130 )
131 cls.a2.save()
132 cls.a2.categories.set([music, op_ed])
133
134 def test_serialize(self):
135 """Basic serialization works."""

Callers

nothing calls this directly

Calls 4

ArticleClass · 0.50
createMethod · 0.45
saveMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected