Remove settings dependency from test

This commit is contained in:
Gergely Polonkai 2015-11-27 12:32:18 +01:00
parent a39742e991
commit 5093ab1e6d

View File

@ -1,6 +1,5 @@
# -*- coding: utf-8 # -*- coding: utf-8
from datetime import timedelta from datetime import timedelta
from django.conf import settings
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.utils import timezone from django.utils import timezone
@ -77,14 +76,14 @@ class DrawTest(TestCase):
draw.save() draw.save()
self.assertEquals(self.word, self.user.current_word()) self.assertEquals(self.word, self.user.current_word())
@override_settings(DRAW_TIME='1 00:00:00')
def test_draw_word(self): def test_draw_word(self):
draw = Draw.objects.create(user=self.user, draw = Draw.objects.create(user=self.user,
word=self.word, word=self.word,
accepted=None) accepted=None)
self.assertEquals(self.word, self.user.draw_word()) self.assertEquals(self.word, self.user.draw_word())
draw.accepted = True draw.accepted = True
duration = parse_duration(settings.DRAW_TIME) draw.timestamp -= datetime.timespan(days=2)
draw.timestamp -= 2 * duration
draw.save() draw.save()
Work.objects.create(draw=draw) Work.objects.create(draw=draw)