Device detection and accompanying rule
Signed-off-by: Jasper Berghoef <jasper.berghoef@gmail.com>
This commit is contained in:
@ -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():
|
||||
|
Reference in New Issue
Block a user