Skip to content

Commit 5c8662a

Browse files
refactor: improve test case
1 parent 6a8208a commit 5c8662a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/test_image_explorer.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import unittest
22
from unittest.mock import Mock
3+
import xml
34
from mock import patch
45
import re
56
from lxml import etree
@@ -98,7 +99,11 @@ def test_static_urls_conversion(self):
9899
Test static urls are processed to absolute if
99100
`absolute_urls` is set
100101
"""
101-
relative_url = self.image_explorer_block._replace_relative_static_urls(self.image_url)
102+
xmltree = etree.fromstring(self.image_explorer_xml)
103+
description = self.image_explorer_block._inner_content(
104+
xmltree.find('description'), absolute_urls=True
105+
)
106+
relative_url = etree.HTML(description).find('.//img').get('src')
102107
self.assertEqual(relative_url, self.processed_absolute_url)
103108

104109
def test_student_view_multi_device_support(self):

0 commit comments

Comments
 (0)