Skip to content

Commit

Permalink
More convinient tests exports
Browse files Browse the repository at this point in the history
  • Loading branch information
f213 committed Jan 3, 2017
1 parent ef4e7fa commit 027ebb9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions elk/utils/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"""
import random
from datetime import datetime
from unittest.mock import Mock, patch
from unittest.mock import MagicMock, patch

import pytz
from django.conf import settings
Expand All @@ -27,6 +27,16 @@
from market.sortinghat import SortingHat
from timeline.models import Entry as TimelineEntry

__all__ = [
'TestCase',
'ClientTestCase',
'create_teacher',
'create_customer',
'mixer',
'MagicMock',
'patch',
]


def __add_all_lessons(teacher):
for lesson in ContentType.objects.filter(app_label='lessons'):
Expand Down Expand Up @@ -84,7 +94,7 @@ def mock_request(customer=None):
Mock a request object, typicaly used for tests when buying a class
"""

request = Mock()
request = MagicMock()
request.user_agent.is_mobile = bool(random.getrandbits(1))
request.user_agent.is_tablet = bool(random.getrandbits(1))
request.user_agent.is_pc = bool(random.getrandbits(1))
Expand Down

0 comments on commit 027ebb9

Please sign in to comment.