Skip to content

Commit

Permalink
feat: updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rayzhou-bit committed Jan 17, 2025
1 parent 637ff20 commit 78727f2
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions cms/djangoapps/contentstore/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,17 +281,23 @@ def test_hash_tags_stripped_from_url_lists(self):
def test_urls_out_count_equals_urls_in_count_when_no_hashtags(self):
raise NotImplementedError

def test_http_url_not_recognized_as_studio_url_scheme(self):
self.assertFalse(_is_studio_url(f'http://www.google.com'))

def test_https_url_not_recognized_as_studio_url_scheme(self):
self.assertFalse(_is_studio_url(f'https://www.google.com'))

def test_http_with_studio_base_url_recognized_as_studio_url_scheme(self):
self.assertTrue(_is_studio_url(f'http://{settings.CMS_BASE}/testurl'))

def test_https_with_studio_base_url_recognized_as_studio_url_scheme(self):
self.assertTrue(_is_studio_url(f'https://{settings.CMS_BASE}/testurl'))

def test_url_is_recognized_as_studio_url_scheme(self):
self.assertTrue(_is_studio_url(f'/url'))
def test_container_url_without_url_base_is_recognized_as_studio_url_scheme(self):
self.assertTrue(_is_studio_url(f'container/test'))

def test_url_not_recognized_as_studio_url_scheme(self):
self.assertFalse(_is_studio_url(f'http://nonedxurl.test'))
def test_slash_url_without_url_base_is_recognized_as_studio_url_scheme(self):
self.assertTrue(_is_studio_url(f'/static/test'))

@pytest.mark.parametrize("url, course_key, post_substitution_url",
["/static/anything_goes_here?raw", "1", "2"])
Expand Down

0 comments on commit 78727f2

Please sign in to comment.