Files
edx-platform/openedx/features/calendar_sync/tests/test_init.py
Dillon Dumesnil 57dbb2d47c AA-33: Function to create calendar event id
The function will create a unique event id using a user and assignment
2020-02-21 11:41:16 -05:00

26 lines
864 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 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()
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'
event_id = get_calendar_event_id(self.user, block_key, date_type)
expected = '{username}.{block_key}.{date_type}'.format(
username=self.user.username, block_key=block_key, date_type=date_type
)
self.assertEqual(event_id, expected)