-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/unit-test', #4
- Loading branch information
Showing
5 changed files
with
32 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
SECRET_KEY = 'fake-key' | ||
|
||
INSTALLED_APPS = [ | ||
'polls', | ||
'tests', | ||
] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import sys | ||
from django.test import TestCase | ||
|
||
from polls.models import Poll | ||
|
||
|
||
class PollTests(TestCase): | ||
def setUp(self): | ||
self.poll = Poll.objects.create( | ||
question='How are you?' | ||
) | ||
|
||
def test_model_creation(self): | ||
self.assertIsNotNone(self.poll) | ||
self.assertIsInstance(self.poll, Poll) | ||
|
||
def test_model_save(self): | ||
self.poll.save() | ||
self.assertIsNotNone(self.poll.pk) | ||
self.assertTrue(self.poll.pk > 0) | ||
|
||
def test_to_string(self): | ||
if sys.version_info > (3,): | ||
self.assertEquals(str(self.poll), 'How are you?') | ||
else: | ||
self.assertEquals(unicode(self.poll), 'How are you?') |
This file was deleted.
Oops, something went wrong.