Skip to content

Commit

Permalink
Merge pull request #3168 from uw-it-aca/qa
Browse files Browse the repository at this point in the history
Qa
  • Loading branch information
fanglinfang authored Nov 18, 2024
2 parents 4f40552 + ff4783a commit bc1d874
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cypress/fixtures/resources/all.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
},
{
"title": "How to Register for PCE Courses",
"url": "https://www.degreereg.uw.edu/user-guide"
"url": "https://www.degreereg.uw.edu/how-to-register"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion cypress/fixtures/resources/pinned.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
},
{
"title": "How to Register for PCE Courses",
"url": "https://www.degreereg.uw.edu/user-guide"
"url": "https://www.degreereg.uw.edu/how-to-register"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion docker/prod-values.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
autoscaling:
enabled: true
minReplicas: 25
minReplicas: 4
maxReplicas: 150
targetAverageUtilization: 100
resources:
Expand Down
4 changes: 2 additions & 2 deletions myuw/data/resource_link_import.csv
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Academics,Registration,all,https://sdb.admin.uw.edu/students/uwnetid/register.as
Academics,Registration,all,,,https://sdb.admin.uw.edu/timeschd/uwnetid/findschd.asp,Schedule Finder,https://sdb.admin.uw.edu/timeschd/uwnetid/findschd.asp,Schedule Finder,,,no
Academics,Registration,all,,,http://www.washington.edu/students/timeschd/,UW Seattle Time Schedule,https://www.uwb.edu/registrar/time,UW Bothell Time Schedule,http://www.tacoma.uw.edu/ts-quicksearch/,UW Tacoma Time Schedule,no
Academics,Registration,all,http://www.washington.edu/students/timeschd/95index.html,Professional & Continuing Education (PCE) Time Schedule,,,,,,,no
Academics,Registration,all,https://www.degreereg.uw.edu/user-guide,How to Register for PCE Courses,,,,,,,no
Academics,Registration,all,https://www.degreereg.uw.edu/how-to-register,How to Register for PCE Courses,,,,,,,no
Academics,Rights and Responsibilities,all,http://www.washington.edu/students/reg/ferpa.html,Family Educational Rights and Privacy Act (FERPA) – Privacy of Student Information,,,,,,,no
Academics,Rights and Responsibilities,all,,,http://www.washington.edu/cssc/student-conduct-overview/student-code-of-conduct/,Student Conduct Code,https://www.uwb.edu/student-affairs/studentconduct,Student Conduct and Responsibility,https://www.tacoma.uw.edu/student-conduct/student-code,Student Conduct Code,no
Academics,Tools and Software,all,http://canvas.uw.edu/,Canvas LMS,,,,,,,no
Expand Down Expand Up @@ -105,7 +105,7 @@ Events and Activities,Stay Connected,all,,,http://www.youtube.com/user/uwhuskies
Events and Activities,Stay Connected,all,,,https://www.instagram.com/uofwa/,UW Instagram,https://instagram.com/UW_BOTHELL,UW Bothell Instagram,https://www.instagram.com/uwtacoma,UW Tacoma Instagram,no
Events and Activities,Stay Connected,all,,,https://twitter.com/UW,UW Twitter,https://twitter.com/UWBothell,UW Bothell Twitter,https://twitter.com/uwtacoma,UW Tacoma Twitter,no
Events and Activities,Stay Connected,all,,,https://www.linkedin.com/company/university-of-washington,UW LinkedIn,https://www.linkedin.com/groups/University-Washington-Bothell-92858?home=&gid=92858,UW Bothell LinkedIn,https://www.linkedin.com/school/university-of-washington-tacoma/,UW Tacoma LinkedIn,no
Events and Activities,Student Clubs and Organizations,all,,,https://hub.washington.edu/sao/rso-directory/,Registered Student Organizations (RSO) Directory,https://uwb.presence.io/organizations,Club Directory,https://dawgden.tacoma.uw.edu/Organizations,UW Tacoma Clubs and Organizations,no
Events and Activities,Student Clubs and Organizations,all,,,https://hub.washington.edu/sao/rso-directory/,Registered Student Organizations (RSO) Directory,https://www.uwb.edu/sea/clubs,Club Directory,https://dawgden.tacoma.uw.edu/Organizations,UW Tacoma Clubs and Organizations,no
"Health, Wellness, & Support",Advocacy and Support,all,https://www.washington.edu/ombud/,Office of the Ombud,,,,,,,no
"Health, Wellness, & Support",Advocacy and Support,all,https://www.washington.edu/compliance/titleix/,Office of the Title IX Coordinator,,,,,,,no
"Health, Wellness, & Support",Advocacy and Support,all,http://www.washington.edu/bias/,Reporting Bias Incidents,,,,,,,no
Expand Down
11 changes: 11 additions & 0 deletions myuw/test/views/test_notice_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
"Operations-Updates\">Husky Card Operations</a> page for " +
"more information.\n</p>")

CONTENT1_MUWM5374 = (
"with <a href=“http://www.margaretomara.com/”>a</a>")
CONTENT2_MUWM5374 = (
"with <a href=‘http://www.margaretomara.com/’>a</a>")


class TestNoticeAdmin(MyuwApiTest):

Expand All @@ -47,6 +52,12 @@ def test_get_html(self):
self.assertIsNone(_get_html(None))
self.assertEqual(_get_html(''), "")
self.assertIsNotNone(_get_html(CONTENT))
self.assertEqual(
_get_html(CONTENT1_MUWM5374),
"with <a href=\"http://www.margaretomara.com/\">a</a>")
self.assertEqual(
_get_html(CONTENT2_MUWM5374),
"with <a href=\"http://www.margaretomara.com/\">a</a>")

@patch.object(MyuwNotice, 'save')
def test_sql_error_save(self, mock):
Expand Down
13 changes: 12 additions & 1 deletion myuw/views/notice_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def _save_notice(request, context, notice_id=None):

try:
content = _get_html(request.POST.get('content'))
logger.debug({'content': content})
except Exception as ex:
content = None
log_info(logger, {'err': ex, 'msg': 'Invalid content'})
Expand Down Expand Up @@ -273,11 +274,21 @@ def _get_integer(str):
def _get_html(value):
try:
content = nh3.clean(
value, tags=ALLOWED_TAGS, attributes=ALLOWED_ATTS,
remove_curly_quotes(value), # MUWM-5374
tags=ALLOWED_TAGS,
attributes=ALLOWED_ATTS,
link_rel=None)
return unicodedata.normalize("NFKD", content).strip()
# MUWM-5092
except TypeError as ex:
log_info(
logger, {'err': ex, 'msg': "_get_html({})".format(value)})
return None


def remove_curly_quotes(html_string):
# MUWM-5374: Replace curly double and single quotes with straight quotes
if html_string:
html_string = html_string.replace("“", '"').replace("”", '"')
html_string = html_string.replace("‘", "'").replace("’", "'")
return html_string
4 changes: 2 additions & 2 deletions myuw_vue/components/home/registration/resources.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</div>
<div v-if="isC2" class="text-center myuw-text-md">
<a
href="https://www.degreereg.uw.edu/user-guide">
href="https://www.degreereg.uw.edu/how-to-register">
How to register for PCE courses
</a>
</div>
Expand Down Expand Up @@ -72,7 +72,7 @@
</a>
</li>
<li v-if="isC2 && !registrationIsOpen" class="mb-1">
<a href="https://www.degreereg.uw.edu/user-guide">
<a href="https://www.degreereg.uw.edu/how-to-register">
How to register for PCE courses
</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion myuw_vue/tests/mock_data/resources/all.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
},
{
"title": "How to Register for PCE Courses",
"url": "https://www.degreereg.uw.edu/user-guide"
"url": "https://www.degreereg.uw.edu/how-to-register"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion myuw_vue/tests/mock_data/resources/pinned.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
},
{
"title": "How to Register for PCE Courses",
"url": "https://www.degreereg.uw.edu/user-guide"
"url": "https://www.degreereg.uw.edu/how-to-register"
}
]
}
Expand Down

0 comments on commit bc1d874

Please sign in to comment.