From 7c6608cf2ce2af827d936485b48d735dc89c28ea Mon Sep 17 00:00:00 2001 From: Boris Besemer Date: Wed, 30 Nov 2016 08:35:11 +0100 Subject: [PATCH] adds more testing stuff --- tests/factories/site.py | 11 +++++++++++ tests/test_models.py | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 tests/factories/site.py diff --git a/tests/factories/site.py b/tests/factories/site.py new file mode 100644 index 0000000..021de81 --- /dev/null +++ b/tests/factories/site.py @@ -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 diff --git a/tests/test_models.py b/tests/test_models.py index 1687b8c..321c1f0 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -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() +