def test_create_user_course_tags(self): """Create user preference tags and confirm properties are set accordingly. """ user = UserFactory.create() course = CourseFactory.create() tag = UserCourseTagFactory.create(user=user, course_id=course.id, key="testkey", value="foobar") self.assertEquals(tag.user, user) self.assertEquals(tag.course_id, course.id) self.assertEquals(tag.key, "testkey") self.assertEquals(tag.value, "foobar")
def test_tag_context(self): for key, value in (('int_value', 1), ('str_value', "two")): UserCourseTagFactory.create( course_id=self.course_id, user=self.user, key=key, value=value, ) UserCourseTagFactory.create( course_id=self.course_id, user=self.other_user, key="other_user", value="other_user_value" ) UserCourseTagFactory.create( course_id='other/course/id', user=self.user, key="other_course", value="other_course_value" ) self.process_request() self.assertContextSetTo({ 'course_id': self.course_id, 'course_user_tags': { 'int_value': '1', 'str_value': 'two', } })
def test_tag_context(self): for key, value in (('int_value', 1), ('str_value', "two")): UserCourseTagFactory.create( course_id=self.course_id, user=self.user, key=key, value=value, ) UserCourseTagFactory.create(course_id=self.course_id, user=self.other_user, key="other_user", value="other_user_value") UserCourseTagFactory.create(course_id='other/course/id', user=self.user, key="other_course", value="other_course_value") self.process_request() self.assertContextSetTo({ 'course_id': self.course_id, 'course_user_tags': { 'int_value': '1', 'str_value': 'two', } })
def test_tag_context(self): for key, value in (("int_value", 1), ("str_value", "two")): UserCourseTagFactory.create(course_id=self.course_id, user=self.user, key=key, value=value) UserCourseTagFactory.create( course_id=self.course_id, user=self.other_user, key="other_user", value="other_user_value" ) UserCourseTagFactory.create( course_id="other/course/id", user=self.user, key="other_course", value="other_course_value" ) self.process_request() self.assertContextSetTo( {"course_id": self.course_id, "course_user_tags": {"int_value": "1", "str_value": "two"}} )