hjwp/Test-Driven-Django-Tutorial — Issue #5: Test fails even after defining the pub_date attrib
Author: eugiellimpin
Created: 2011-11-01 20:43:22+00:00
State: open

I hope I'm not annoying you with all these issues. If so, tell me and I'll stop and I'll keep them to myself. ;)

Under section **Our first unit tests: testing a new "Poll" model** even after defining the pub_date attrib in the model Poll, the test fails saying ```IntegrityError: polls_poll.pub_date may not be Null```

Instead of

# start by creating a new Poll object with its "question" set
poll = Poll()
poll.question = "What's up?"

# check we can save it to the database
poll.save()

# check we can adjust its publication date
poll.pub_date = datetime.datetime(2012, 12, 25)
poll.save()

I believe it should be

# start by creating a new Poll object with its "question" set
poll = Poll()
poll.question = "What's up?"

# check we can adjust its publication date
poll.pub_date = datetime.datetime(2012, 12, 25)

# check we can save it to the database
poll.save()