-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c1bf98b
commit 330d7f3
Showing
4 changed files
with
49 additions
and
3 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
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,3 +1,43 @@ | ||
from django.test import TestCase | ||
import datetime | ||
from django.utils import timezone | ||
from django.test import TestCase | ||
|
||
from .models import Question | ||
# Create your tests here. | ||
|
||
class Player(object): | ||
pass | ||
|
||
class SparringRoom(object): | ||
def enter(self, player): | ||
|
||
if player.rope: | ||
return {'message' : 'You have a rope!'} | ||
else: | ||
return {'message' : 'No rope for you'} | ||
|
||
class QuestionMethodTests(TestCase): | ||
|
||
def test_was_published_recently_with_future_question(self): | ||
""" | ||
was_published_recently() should return False for questions whose | ||
pub_date is in the future. | ||
""" | ||
time = timezone.now() + datetime.timedelta(days=20) | ||
future_question = Question(pub_date=time) | ||
self.assertEqual(future_question.was_published_recently(), False) | ||
|
||
def test_message_user_with_rope(self): | ||
player = Player() | ||
player.rope = True | ||
room = SparringRoom() | ||
output = room.enter(player) | ||
self.assertEqual(output['message'], "You have a rope!") | ||
|
||
def test_message_user_with_rope(self): | ||
player = Player() | ||
player.rope = False | ||
room = SparringRoom() | ||
output = room.enter(player) | ||
self.assertEqual(output['message'], "No rope for you") |