Files
edx-platform/openedx/features/calendar_sync/tests/test_init.py

27 lines
992 B
Python

""" Tests the contents of the __init__.py file """
from django.test import TestCase
from openedx.features.calendar_sync import get_calendar_event_id
from common.djangoapps.student.tests.factories import UserFactory
TEST_PASSWORD = 'test'
class TestCalendarSyncInit(TestCase):
""" Tests for the contents of __init__.py """
def setUp(self):
super(TestCalendarSyncInit, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.user = UserFactory(password=TEST_PASSWORD)
def test_get_calendar_event_id(self):
block_key = 'block-v1:Org+Number+Term+type@sequential+block@gibberish'
date_type = 'due'
hostname = 'example.com'
event_id = get_calendar_event_id(self.user, block_key, date_type, hostname)
expected = '{user_id}.{block_key}.{date_type}@{hostname}'.format(
user_id=self.user.id, block_key=block_key, date_type=date_type, hostname=hostname
)
assert event_id == expected