Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
82c26f9772 | |||
03eb812e45 | |||
e3522d0acb | |||
7f5e958ee3 | |||
241bfb5240 |
4
CHANGES
4
CHANGES
@ -1,3 +1,7 @@
|
|||||||
|
0.11.3
|
||||||
|
==================
|
||||||
|
- Bugfix: Handle errors when testing an invalid visit count rule
|
||||||
|
|
||||||
0.11.2
|
0.11.2
|
||||||
==================
|
==================
|
||||||
- Bugfix: Stop populating static segments when the count is reached
|
- Bugfix: Stop populating static segments when the count is reached
|
||||||
|
@ -55,10 +55,10 @@ author = 'Lab Digital BV'
|
|||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = '0.11.2'
|
version = '0.11.3'
|
||||||
|
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = '0.11.2'
|
release = '0.11.3'
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 0.11.2
|
current_version = 0.11.3
|
||||||
commit = true
|
commit = true
|
||||||
tag = true
|
tag = true
|
||||||
tag_name = {new_version}
|
tag_name = {new_version}
|
||||||
|
2
setup.py
2
setup.py
@ -32,7 +32,7 @@ with open('README.rst') as fh:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='wagtail-personalisation-molo',
|
name='wagtail-personalisation-molo',
|
||||||
version='0.11.2',
|
version='0.11.3',
|
||||||
description='A forked version of Wagtail add-on for showing personalized content',
|
description='A forked version of Wagtail add-on for showing personalized content',
|
||||||
author='Praekelt.org',
|
author='Praekelt.org',
|
||||||
author_email='dev@praekeltfoundation.org',
|
author_email='dev@praekeltfoundation.org',
|
||||||
|
@ -6,6 +6,7 @@ from importlib import import_module
|
|||||||
|
|
||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.contrib.sessions.models import Session
|
from django.contrib.sessions.models import Session
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.template.defaultfilters import slugify
|
from django.template.defaultfilters import slugify
|
||||||
@ -239,6 +240,12 @@ class VisitCountRule(AbstractBaseRule):
|
|||||||
from wagtail_personalisation.adapters import (
|
from wagtail_personalisation.adapters import (
|
||||||
get_segment_adapter, SessionSegmentsAdapter, SEGMENT_ADAPTER_CLASS)
|
get_segment_adapter, SessionSegmentsAdapter, SEGMENT_ADAPTER_CLASS)
|
||||||
|
|
||||||
|
# Django formsets don't honour 'required' fields so check rule is valid
|
||||||
|
try:
|
||||||
|
self.counted_page
|
||||||
|
except ObjectDoesNotExist:
|
||||||
|
return False
|
||||||
|
|
||||||
if user:
|
if user:
|
||||||
# Create a fake request so we can use the adapter
|
# Create a fake request so we can use the adapter
|
||||||
request = RequestFactory().get('/')
|
request = RequestFactory().get('/')
|
||||||
|
@ -2,6 +2,7 @@ import pytest
|
|||||||
|
|
||||||
from tests.factories.rule import VisitCountRuleFactory
|
from tests.factories.rule import VisitCountRuleFactory
|
||||||
from tests.factories.segment import SegmentFactory
|
from tests.factories.segment import SegmentFactory
|
||||||
|
from wagtail_personalisation.rules import VisitCountRule
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
@ -25,6 +26,12 @@ def test_visit_count(site, client):
|
|||||||
assert visit_count[1]['count'] == 1
|
assert visit_count[1]['count'] == 1
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db
|
||||||
|
def test_call_test_user_on_invalid_rule_fails(site, user, mocker):
|
||||||
|
rule = VisitCountRule()
|
||||||
|
assert not (rule.test_user(None, user))
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_visit_count_call_test_user_with_user(site, client, user):
|
def test_visit_count_call_test_user_with_user(site, client, user):
|
||||||
segment = SegmentFactory(name='VisitCount')
|
segment = SegmentFactory(name='VisitCount')
|
||||||
|
Reference in New Issue
Block a user