コード例 #1
0
 def test_blank_data(self, db):
     form = BoardForm({})
     assert not form.is_valid()
     assert form.errors == {
         'title': ['This field is required.'],
         'slug': ['This field is required.'],
     }
コード例 #2
0
 def test_blank_data(self, db):
     form = BoardForm({})
     assert not form.is_valid()
     assert form.errors == {
         "title": ["This field is required."],
         "slug": ["This field is required."],
         "palette": ["This field is required."],
     }
コード例 #3
0
 def test_valid_data(self, user):
     form = BoardForm({
         'slug': "slug",
         'title': 'title',
         'description': "description",
     })
     assert form.is_valid()
     board = form.save(commit=False)
     board.owner = user
     board.save()
     assert board.title == "title"
     assert board.slug == "slug"
     assert board.description == "description"
コード例 #4
0
 def test_valid_data(self, user):
     form = BoardForm({
         "slug": "slug",
         "title": "title",
         "description": "description",
         "palette": "Grey"
     })
     assert form.is_valid()
     board = form.save(commit=False)
     board.owner = user
     board.save()
     assert board.title == "title"
     assert board.slug == "slug"
     assert board.description == "description"
     assert board.palette == "Grey"
コード例 #5
0
 def test_init(self):
     BoardForm()