def test_categories(self): categorization = NOTICE_CATEGORIES.get("StudentALR_IntlStuCheckin", None) self.assertIsNotNone(categorization) self.assertEqual(categorization["myuw_category"], "Holds") self.assertTrue(categorization["critical"]) self.assertEqual(len(categorization["location_tags"]), 2) categorization = NOTICE_CATEGORIES.get("StudentFinAid_AidHoldShort", None) self.assertIsNotNone(categorization) self.assertEqual(categorization["myuw_category"], "Fees & Finances") self.assertFalse(categorization["critical"]) self.assertEqual(len(categorization["location_tags"]), 1)
def test_categories(self): categorization = NOTICE_CATEGORIES.get( "StudentALR_IntlStuCheckin", None) self.assertIsNotNone(categorization) self.assertEqual(categorization["myuw_category"], "Holds") self.assertTrue(categorization["critical"]) self.assertEqual(len(categorization["location_tags"]), 2) categorization = NOTICE_CATEGORIES.get( "StudentFinAid_AidHoldShort", None) self.assertIsNotNone(categorization) self.assertEqual(categorization["myuw_category"], "Fees & Finances") self.assertFalse(categorization["critical"]) self.assertEqual(len(categorization["location_tags"]), 1)
def map_notice_category(notice): """ Set the custom_category, is_critical, location_tags for the given notice based on the NOTICE_CATEGORIES defined in myuw.dao.notice_categorization """ key = notice.notice_category + "_" + notice.notice_type categorization = NOTICE_CATEGORIES.get(key, None) if categorization is not None: notice.custom_category = categorization["myuw_category"] notice.is_critical = categorization["critical"] notice.location_tags = categorization["location_tags"] else: notice.custom_category = UNKNOWN_CATEGORY_NAME notice.is_critical = False notice.location_tags = None return notice