8

adds more testing stuff

This commit is contained in:
Boris Besemer
2016-11-30 08:35:11 +01:00
parent 3b592d21d2
commit 7c6608cf2c
2 changed files with 19 additions and 0 deletions

11
tests/factories/site.py Normal file
View File

@@ -0,0 +1,11 @@
import factory
from wagtail.wagtailcore.models import Site
class SiteFactory(factory.DjangoModelFactory):
hostname = 'localhost'
port = 8000
site_name = 'Testing Site'
is_default_site = True
class Meta
model = Site

View File

@@ -5,12 +5,15 @@ from freezegun import freeze_time
from personalisation import models
def
"""Base Rule tests"""
def test_create_base_rule():
base_rule = models.AbstractBaseRule()
assert base_rule.test_user() is True
"""Time Rule tests"""
@freeze_time("10:00:00")
def test_create_time_rule():
time_rule = models.TimeRule(start_time=datetime.time(8, 0, 0), end_time=datetime.time(23, 0, 0))
@@ -35,3 +38,8 @@ def test_time_rule_reverse_next_day():
assert time_rule.test_user() is False
"""Visit Count Rule tests"""
def test_visit_count_rule():
visit_count_rule = models.VisitCountRule()