7

Device detection and accompanying rule

Signed-off-by: Jasper Berghoef <jasper.berghoef@gmail.com>
This commit is contained in:
Jasper Berghoef
2017-01-11 15:28:40 +01:00
parent a7b477d71f
commit 597c0a50f0
5 changed files with 75 additions and 4 deletions

View File

@ -6,7 +6,7 @@ import pytest
from personalisation.models import Segment, TimeRule
from tests.factories.segment import (
ReferralRuleFactory, SegmentFactory, TimeRuleFactory, DayRuleFactory)
ReferralRuleFactory, SegmentFactory, TimeRuleFactory, DayRuleFactory, DeviceRuleFactory)
"""Factory tests"""
@pytest.mark.django_db
@ -39,6 +39,17 @@ def test_create_segment_with_day_rule():
assert day_rule.sun is False
"""DeviceRuleFactory tests"""
@pytest.mark.django_db
def test_create_segment_with_device_rule():
segment = SegmentFactory(name='DeviceSegment')
device_rule = DeviceRuleFactory(mobile=True, segment=segment)
assert device_rule.mobile is True
assert device_rule.tablet is False
assert device_rule.desktop is False
"""ReferralRuleFactory tests"""
@pytest.mark.django_db
def test_create_segment_with_referral_rule():