How to use assertHTMLEqual method in pytest-django

Best Python code snippet using pytest-django_python

test_course_updates.py

Source:test_course_updates.py Github

copy

Full Screen

...34 self.assertContains(resp, 'Course Updates', status_code=200)35 init_content = '<iframe width="560" height="315" src="http://www.youtube.com/embed/RocY-Jd93XU" frameborder="0">'36 content = init_content + '</iframe>'37 payload = get_response(content, 'January 8, 2013')38 self.assertHTMLEqual(payload['content'], content)39 first_update_url = self.create_update_url(provided_id=payload['id'])40 content += '<div>div <p>p<br/></p></div>'41 payload['content'] = content42 # POST requests were coming in w/ these header values causing an error; so, repro error here43 resp = self.client.ajax_post(44 first_update_url, payload, HTTP_X_HTTP_METHOD_OVERRIDE="PUT", REQUEST_METHOD="POST"45 )46 self.assertHTMLEqual(content, json.loads(resp.content)['content'],47 "iframe w/ div")48 # refetch using provided id49 refetched = self.client.get_json(first_update_url)50 self.assertHTMLEqual(51 content, json.loads(refetched.content)['content'], "get w/ provided id"52 )53 # now put in an evil update54 content = '<ol/>'55 payload = get_response(content, 'January 11, 2013')56 self.assertHTMLEqual(content, payload['content'], "self closing ol")57 course_update_url = self.create_update_url()58 resp = self.client.get_json(course_update_url)59 payload = json.loads(resp.content)60 self.assertTrue(len(payload) == 2)61 # try json w/o required fields62 self.assertContains(63 self.client.ajax_post(course_update_url, {'garbage': 1}),64 'Failed to save', status_code=40065 )66 # test an update with text in the tail of the header67 content = 'outside <strong>inside</strong> after'68 payload = get_response(content, 'June 22, 2000')69 self.assertHTMLEqual(content, payload['content'], "text outside tag")70 # now try to update a non-existent update71 content = 'blah blah'72 payload = {'content': content, 'date': 'January 21, 2013'}73 self.assertContains(74 self.client.ajax_post(course_update_url + '9', payload),75 'Failed to save', status_code=40076 )77 # update w/ malformed html78 content = '<garbage tag No closing brace to force <span>error</span>'79 payload = {'content': content,80 'date': 'January 11, 2013'}81 self.assertContains(82 self.client.ajax_post(course_update_url, payload),83 '<garbage'84 )85 # set to valid html which would break an xml parser86 content = "<p><br><br></p>"87 payload = get_response(content, 'January 11, 2013')88 self.assertHTMLEqual(content, payload['content'])89 # now try to delete a non-existent update90 self.assertContains(self.client.delete(course_update_url + '19'), "delete", status_code=400)91 # now delete a real update92 content = 'blah blah'93 payload = get_response(content, 'January 28, 2013')94 this_id = payload['id']95 self.assertHTMLEqual(content, payload['content'], "single iframe")96 # first count the entries97 resp = self.client.get_json(course_update_url)98 payload = json.loads(resp.content)99 before_delete = len(payload)100 url = self.create_update_url(provided_id=this_id)101 resp = self.client.delete(url)102 payload = json.loads(resp.content)103 self.assertTrue(len(payload) == before_delete - 1)104 def test_course_updates_compatibility(self):105 '''106 Test that course updates doesn't break on old data (content in 'data' field).107 Note: new data will save as list in 'items' field.108 '''109 # get the updates and populate 'data' field with some data.110 location = self.course.id.make_usage_key('course_info', 'updates')111 course_updates = modulestore().create_item(112 self.user.id,113 location.course_key,114 location.block_type,115 block_id=location.block_id116 )117 update_date = u"January 23, 2014"118 update_content = u"Hello world!"119 update_data = u"<ol><li><h2>" + update_date + "</h2>" + update_content + "</li></ol>"120 course_updates.data = update_data121 modulestore().update_item(course_updates, self.user.id)122 # test getting all updates list123 course_update_url = self.create_update_url()124 resp = self.client.get_json(course_update_url)125 payload = json.loads(resp.content)126 self.assertEqual(payload, [{u'date': update_date, u'content': update_content, u'id': 1}])127 self.assertTrue(len(payload) == 1)128 # test getting single update item129 first_update_url = self.create_update_url(provided_id=payload[0]['id'])130 resp = self.client.get_json(first_update_url)131 payload = json.loads(resp.content)132 self.assertEqual(payload, {u'date': u'January 23, 2014', u'content': u'Hello world!', u'id': 1})133 self.assertHTMLEqual(update_date, payload['date'])134 self.assertHTMLEqual(update_content, payload['content'])135 # test that while updating it converts old data (with string format in 'data' field)136 # to new data (with list format in 'items' field) and respectively updates 'data' field.137 course_updates = modulestore().get_item(location)138 self.assertEqual(course_updates.items, [])139 # now try to update first update item140 update_content = 'Testing'141 payload = {'content': update_content, 'date': update_date}142 resp = self.client.ajax_post(143 course_update_url + '1', payload, HTTP_X_HTTP_METHOD_OVERRIDE="PUT", REQUEST_METHOD="POST"144 )145 self.assertHTMLEqual(update_content, json.loads(resp.content)['content'])146 course_updates = modulestore().get_item(location)147 self.assertEqual(course_updates.items, [{u'date': update_date, u'content': update_content, u'id': 1}])148 # course_updates 'data' field should update accordingly149 update_data = u"<section><article><h2>{date}</h2>{content}</article></section>".format(date=update_date, content=update_content)150 self.assertEqual(course_updates.data, update_data)151 # test delete course update item (soft delete)152 course_updates = modulestore().get_item(location)153 self.assertEqual(course_updates.items, [{u'date': update_date, u'content': update_content, u'id': 1}])154 # now try to delete first update item155 resp = self.client.delete(course_update_url + '1')156 self.assertEqual(json.loads(resp.content), [])157 # confirm that course update is soft deleted ('status' flag set to 'deleted') in db158 course_updates = modulestore().get_item(location)159 self.assertEqual(course_updates.items,160 [{u'date': update_date, u'content': update_content, u'id': 1, u'status': 'deleted'}])161 # now try to get deleted update162 resp = self.client.get_json(course_update_url + '1')163 payload = json.loads(resp.content)164 self.assertEqual(payload.get('error'), u"Course update not found.")165 self.assertEqual(resp.status_code, 404)166 # now check that course update don't munges html167 update_content = u"""&lt;problem>168 &lt;p>&lt;/p>169 &lt;multiplechoiceresponse>170 <pre>&lt;problem>171 &lt;p>&lt;/p></pre>172 <div><foo>bar</foo></div>"""173 payload = {'content': update_content, 'date': update_date}174 resp = self.client.ajax_post(175 course_update_url, payload, REQUEST_METHOD="POST"176 )177 self.assertHTMLEqual(update_content, json.loads(resp.content)['content'])178 def test_no_ol_course_update(self):179 '''Test trying to add to a saved course_update which is not an ol.'''180 # get the updates and set to something wrong181 location = self.course.id.make_usage_key('course_info', 'updates')182 modulestore().create_item(183 self.user.id,184 location.course_key,185 location.block_type,186 block_id=location.block_id187 )188 course_updates = modulestore().get_item(location)189 course_updates.data = 'bad news'190 modulestore().update_item(course_updates, self.user.id)191 init_content = '<iframe width="560" height="315" src="http://www.youtube.com/embed/RocY-Jd93XU" frameborder="0">'192 content = init_content + '</iframe>'193 payload = {'content': content, 'date': 'January 8, 2013'}194 course_update_url = self.create_update_url()195 resp = self.client.ajax_post(course_update_url, payload)196 payload = json.loads(resp.content)197 self.assertHTMLEqual(payload['content'], content)198 # now confirm that the bad news and the iframe make up single update199 resp = self.client.get_json(course_update_url)200 payload = json.loads(resp.content)201 self.assertTrue(len(payload) == 1)202 def post_course_update(self, send_push_notification=False):203 """204 Posts an update to the course205 """206 course_update_url = self.create_update_url(course_key=self.course.id)207 # create a course via the view handler208 self.client.ajax_post(course_update_url)209 content = u"Sample update"210 payload = {'content': content, 'date': 'January 8, 2013'}211 if send_push_notification:212 payload['push_notification_selected'] = True213 resp = self.client.ajax_post(course_update_url, payload)214 # check that response status is 200 not 400215 self.assertEqual(resp.status_code, 200)216 payload = json.loads(resp.content)217 self.assertHTMLEqual(payload['content'], content)218 @patch("contentstore.push_notification.send_push_course_update")219 def test_post_course_update(self, mock_push_update):220 """221 Test that a user can successfully post on course updates and handouts of a course222 """223 self.post_course_update()224 # check that push notifications are not sent225 self.assertFalse(mock_push_update.called)226 updates_location = self.course.id.make_usage_key('course_info', 'updates')227 self.assertTrue(isinstance(updates_location, UsageKey))228 self.assertEqual(updates_location.name, u'updates')229 # check posting on handouts230 handouts_location = self.course.id.make_usage_key('course_info', 'handouts')231 course_handouts_url = reverse_usage_url('xblock_handler', handouts_location)232 content = u"Sample handout"233 payload = {'data': content}234 resp = self.client.ajax_post(course_handouts_url, payload)235 # check that response status is 200 not 500236 self.assertEqual(resp.status_code, 200)237 payload = json.loads(resp.content)238 self.assertHTMLEqual(payload['data'], content)239 @patch("contentstore.push_notification.send_push_course_update")240 def test_notifications_enabled_but_not_requested(self, mock_push_update):241 PushNotificationConfig(enabled=True).save()242 self.post_course_update()243 self.assertFalse(mock_push_update.called)244 @patch("contentstore.push_notification.send_push_course_update")245 def test_notifications_enabled_and_sent(self, mock_push_update):246 PushNotificationConfig(enabled=True).save()247 self.post_course_update(send_push_notification=True)248 self.assertTrue(mock_push_update.called)249 @override_settings(PARSE_KEYS={"APPLICATION_ID": "TEST_APPLICATION_ID", "REST_API_KEY": "TEST_REST_API_KEY"})250 @patch("contentstore.push_notification.Push")251 def test_notifications_sent_to_parse(self, mock_parse_push):252 PushNotificationConfig(enabled=True).save()...

Full Screen

Full Screen

test_validation_forms.py

Source:test_validation_forms.py Github

copy

Full Screen

...26 def test_email_field(self):27 f = EmailForm({'email': 'test@example.com'})28 soup = BeautifulSoup(f.as_p(), 'lxml')29 ul = soup.find(attrs={'ng-show': "RW1haWxGb3Jt['email'].$dirty && !RW1haWxGb3Jt['email'].$untouched"})30 self.assertHTMLEqual(str(ul.li), '<li class="invalid" ng-show="RW1haWxGb3Jt[\'email\'].$error.required">This field is required.</li>')31 self.assertHTMLEqual(str(ul.li.nextSibling), '<li class="invalid" ng-show="RW1haWxGb3Jt[\'email\'].$error.email">Enter a valid email address.</li>')32 self.assertHTMLEqual(str(ul.li.nextSibling.nextSibling), '<li class="valid" ng-show="RW1haWxGb3Jt[\'email\'].$valid"></li>')33 ul = soup.find(attrs={'ng-show': "RW1haWxGb3Jt['email'].$pristine"})34 self.assertHTMLEqual(str(ul.li), '<li class="valid" ng-show="RW1haWxGb3Jt[\'email\'].$valid"></li>')35 self.assertEquals(soup.input.attrs['name'], "email")36 self.assertEquals(soup.input.attrs['ng-model'], "email")37 self.assertEquals(soup.input.attrs['ng-required'], "true")38 self.assertEquals(soup.input.attrs['email-pattern'], '(^[-!#$%&\'*+/=?^_`{}|~0-9A-Z]+(\\.[-!#$%&\'*+/=?^_`{}|~0-9A-Z]+)*@|^"([\\001-\\010\\013\\014\\016-\\037!#-\\[\\]-\\177]|\\\\[\\001-\\011\\013\\014\\016-\\177])*"@)(localhost$|((?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\\.)+)(?:[A-Z0-9-]{2,63})$)')39 self.assertEquals(soup.input.attrs['value'], "test@example.com")40 def test_choice_field(self):41 f = ChoiceForm({'choose': True})42 soup = BeautifulSoup(f.as_p(), 'lxml')43 ul = soup.find(attrs={'ng-show': "Q2hvaWNlRm9ybQ['choose'].$dirty && !Q2hvaWNlRm9ybQ['choose'].$untouched"})44 self.assertHTMLEqual(str(ul.li), '<li class="invalid" ng-show="Q2hvaWNlRm9ybQ[\'choose\'].$error.required">This field is required.</li>')45 self.assertHTMLEqual(str(ul.li.nextSibling), '<li class="valid" ng-show="Q2hvaWNlRm9ybQ[\'choose\'].$valid"></li>')46 ul = soup.find(attrs={'ng-show': "Q2hvaWNlRm9ybQ['choose'].$pristine"})47 self.assertHTMLEqual(str(ul.li), '<li class="valid" ng-show="Q2hvaWNlRm9ybQ[\'choose\'].$valid"></li>')48 self.assertEquals(soup.input.attrs['name'], "choose")49 self.assertEquals(soup.input.attrs['ng-model'], "choose")50 self.assertEquals(soup.input.attrs['ng-required'], "true")51 @unittest.skipIf(DJANGO_VERSION < (1, 11), "currently disabled for Django-1.10 (overridden RadioSelect does not use RadioFieldRendererMixin)")52 def test_radio_field(self):53 f = RadioForm({'sex': 'f'})54 soup = BeautifulSoup(f.as_p(), 'lxml')55 ul = soup.find(attrs={'ng-show': "UmFkaW9Gb3Jt['sex'].$dirty && !UmFkaW9Gb3Jt['sex'].$untouched"})56 self.assertHTMLEqual(str(ul.li.attrs['ng-show']), 'UmFkaW9Gb3Jt[\'sex\'].$error.multifield')57 self.assertHTMLEqual(str(ul.li.text), 'At least one checkbox has to be selected.')58 self.assertHTMLEqual(str(ul.li.nextSibling.attrs['ng-show']), 'UmFkaW9Gb3Jt[\'sex\'].$valid')59 ul = soup.find(attrs={'ng-show': "UmFkaW9Gb3Jt['sex'].$pristine"})60 self.assertHTMLEqual(str(ul.li.attrs['ng-show']), 'UmFkaW9Gb3Jt[\'sex\'].$valid')61 self.assertEquals(soup.label.text, "Sex")62 elem = soup.find(id="id_sex")63 self.assertEquals(elem.label.text.strip(), "Male")64 self.assertEquals(elem.label.input.attrs['id'], "id_sex_0")65 self.assertEquals(elem.label.input.attrs['name'], "sex")66 self.assertEquals(elem.label.input.attrs['value'], "m")67 self.assertEquals(elem.label.input.attrs['ng-model'], "sex")68 self.assertIn('required', elem.label.input.attrs)69 label = elem.label.find_next_sibling('label')70 self.assertEquals(label.text.strip(), "Female")71 self.assertEquals(label.input.attrs['id'], "id_sex_1")72 self.assertEquals(label.input.attrs['name'], "sex")73 self.assertEquals(label.input.attrs['value'], "f")74 self.assertEquals(label.input.attrs['ng-model'], "sex")75 self.assertIn('required', label.input.attrs)76 def test_checkbock_select_multiple_field(self):77 f = SelectMultipleChoicesForm({'select_multi': ['a', 'c']})78 soup = BeautifulSoup(f.as_p(), 'lxml')79 ul = soup.find(attrs={'ng-show': "U2VsZWN0TXVsdGlwbGVDaG9pY2VzRm9ybQ['select_multi'].$dirty && !U2VsZWN0TXVsdGlwbGVDaG9pY2VzRm9ybQ['select_multi'].$untouched"})80 self.assertListEqual(ul.attrs['class'], ["djng-field-errors"])81 self.assertHTMLEqual(ul.li.attrs['ng-show'], "U2VsZWN0TXVsdGlwbGVDaG9pY2VzRm9ybQ['select_multi'].$error.required")82 self.assertHTMLEqual(ul.li.text, 'This field is required.')83 ul = soup.find(attrs={'ng-show': "U2VsZWN0TXVsdGlwbGVDaG9pY2VzRm9ybQ['select_multi'].$pristine"})84 self.assertHTMLEqual(ul.li.attrs['ng-show'], "U2VsZWN0TXVsdGlwbGVDaG9pY2VzRm9ybQ['select_multi'].$valid")85 self.assertEquals(soup.label.text, "Select multi")86 self.assertEquals(soup.label.attrs['for'], "id_select_multi")87 select = soup.find('select')88 self.assertEquals(select.attrs['id'], "id_select_multi")89 self.assertEquals(select.attrs['name'], "select_multi")90 self.assertEquals(select.attrs['multiple'], "multiple")91 self.assertEquals(select.attrs['ng-model'], "select_multi")92 self.assertEquals(select.attrs['ng-required'], "true")93 self.assertEquals(select.option.attrs['value'], "a")94 self.assertEquals(select.option.text, "Choice A")95 option = select.option.find_next_sibling('option')96 self.assertEquals(option.attrs['value'], "b")97 self.assertEquals(option.text, "Choice B")98 option = option.find_next_sibling('option')99 self.assertEquals(option.attrs['value'], "c")100 self.assertIn('selected', option.attrs)101 self.assertEquals(option.text, "Choice C")102 def test_checkbock_check_mulitple_field(self):103 f = CheckboxChoicesForm({'check_multi': ['a', 'c']})104 soup = BeautifulSoup(f.as_p(), 'lxml')105 ul = soup.find(attrs={'ng-show': "Q2hlY2tib3hDaG9pY2VzRm9ybQ['check_multi'].$dirty && !Q2hlY2tib3hDaG9pY2VzRm9ybQ['check_multi'].$untouched"})106 self.assertListEqual(ul.attrs['class'], ["djng-field-errors"])107 self.assertHTMLEqual(str(ul.li.attrs['ng-show']), "Q2hlY2tib3hDaG9pY2VzRm9ybQ['check_multi'].$error.multifield")108 self.assertHTMLEqual(str(ul.li.text), 'At least one checkbox has to be selected.')109 self.assertHTMLEqual(str(ul.li.nextSibling.attrs['ng-show']), "Q2hlY2tib3hDaG9pY2VzRm9ybQ['check_multi'].$valid")110 ul = soup.find(attrs={'ng-show': "Q2hlY2tib3hDaG9pY2VzRm9ybQ['check_multi'].$pristine"})111 self.assertListEqual(ul.attrs['class'], ["djng-field-errors"])112 self.assertHTMLEqual(str(ul.li.attrs['ng-show']), "Q2hlY2tib3hDaG9pY2VzRm9ybQ['check_multi'].$valid")113 self.assertEquals(soup.label.text, "Check multi")114 elem = soup.find(attrs={'ng-form': "check_multi"})115 self.assertTrue(elem.attrs['djng-multifields-required'])116 label = elem.find(attrs={'for': 'id_check_multi_0'})117 self.assertEquals(label.text.strip(), "Choice A")118 self.assertEquals(label.input.attrs['id'], "id_check_multi_0")119 self.assertEquals(label.input.attrs['name'], "check_multi.a")120 self.assertEquals(label.input.attrs['value'], "a")121 self.assertEquals(label.input.attrs['ng-model'], "check_multi['a']")122 self.assertIn('checked', label.input.attrs)123 label = elem.find(attrs={'for': 'id_check_multi_1'})124 self.assertEquals(label.input.attrs['id'], "id_check_multi_1")125 self.assertEquals(label.input.attrs['name'], "check_multi.b")126 self.assertEquals(label.input.attrs['value'], "b")...

Full Screen

Full Screen

test_markups.py

Source:test_markups.py Github

copy

Full Screen

...11class MarkupsTestCase(TestCase):12 text = 'Hello *World* !'13 @skip_if_lib_not_available('textile')14 def test_textile(self):15 self.assertHTMLEqual(16 textile(self.text).strip(),17 '<p>Hello <strong>World</strong> !</p>'18 )19 @skip_if_lib_not_available('markdown')20 def test_markdown(self):21 self.assertHTMLEqual(22 markdown(self.text).strip(),23 '<p>Hello <em>World</em> !</p>'24 )25 @skip_if_lib_not_available('markdown')26 def test_markdown_extensions(self):27 text = '[TOC]\n\n# Header 1\n\n## Header 2'28 self.assertHTMLEqual(29 markdown(text).strip(),30 '<p>[TOC]</p>\n<h1>Header 1</h1>'31 '\n<h2>Header 2</h2>'32 )33 self.assertHTMLEqual(34 markdown(text, extensions=['markdown.extensions.toc']).strip(),35 '<div class="toc">\n<ul>\n<li><a href="#header-1">'36 'Header 1</a><ul>\n<li><a href="#header-2">'37 'Header 2</a></li>\n</ul>\n</li>\n</ul>\n</div>'38 '\n<h1 id="header-1">Header 1</h1>\n'39 '<h2 id="header-2">Header 2</h2>'40 )41 from markdown.extensions.toc import TocExtension42 tocext = TocExtension(marker='--TOC--', permalink='PL')43 self.assertHTMLEqual(44 markdown(text, extensions=[tocext]).strip(),45 '<p>[TOC]</p>\n<h1 id="header-1">Header 1'46 '<a class="headerlink" href="#header-1" '47 'title="Permanent link">PL</a></h1>\n'48 '<h2 id="header-2">Header 2'49 '<a class="headerlink" href="#header-2" '50 'title="Permanent link">PL</a></h2>'51 )52 @skip_if_lib_not_available('docutils')53 def test_restructuredtext(self):54 self.assertHTMLEqual(55 restructuredtext(self.text).strip(),56 '<p>Hello <em>World</em> !</p>'57 )58 @skip_if_lib_not_available('docutils')59 def test_restructuredtext_settings_override(self):60 text = 'My email is toto@example.com'61 self.assertHTMLEqual(62 restructuredtext(text).strip(),63 '<p>My email is <a class="reference external" '64 'href="mailto:toto&#64;example.com">'65 'toto&#64;example.com</a></p>'66 )67 self.assertHTMLEqual(68 restructuredtext(text, {'cloak_email_addresses': True}).strip(),69 '<p>My email is <a class="reference external" '70 'href="mailto:toto&#37;&#52;&#48;example&#46;com">'71 'toto<span>&#64;</span>example<span>&#46;</span>com</a></p>'72 )73class MarkupFailImportTestCase(TestCase):74 exclude_list = ['textile', 'markdown', 'docutils']75 def setUp(self):76 self.original_import = builtins.__import__77 builtins.__import__ = self.import_hook78 def tearDown(self):79 builtins.__import__ = self.original_import80 def import_hook(self, name, *args, **kwargs):81 if name in self.exclude_list:82 raise ImportError('%s module has been disabled' % name)83 else:84 self.original_import(name, *args, **kwargs)85 def test_textile(self):86 with warnings.catch_warnings(record=True) as w:87 result = textile('My *text*')88 self.tearDown()89 self.assertEqual(result, 'My *text*')90 self.assertTrue(issubclass(w[-1].category, RuntimeWarning))91 self.assertEqual(92 str(w[-1].message),93 "The Python textile library isn't installed.")94 def test_markdown(self):95 with warnings.catch_warnings(record=True) as w:96 result = markdown('My *text*')97 self.tearDown()98 self.assertEqual(result, 'My *text*')99 self.assertTrue(issubclass(w[-1].category, RuntimeWarning))100 self.assertEqual(101 str(w[-1].message),102 "The Python markdown library isn't installed.")103 def test_restructuredtext(self):104 with warnings.catch_warnings(record=True) as w:105 result = restructuredtext('My *text*')106 self.tearDown()107 self.assertEqual(result, 'My *text*')108 self.assertTrue(issubclass(w[-1].category, RuntimeWarning))109 self.assertEqual(110 str(w[-1].message),111 "The Python docutils library isn't installed.")112class HtmlFormatTestCase(TestCase):113 def setUp(self):114 self.original_rendering = markups.MARKUP_LANGUAGE115 def tearDown(self):116 markups.MARKUP_LANGUAGE = self.original_rendering117 def test_html_format_default(self):118 markups.MARKUP_LANGUAGE = None119 self.assertHTMLEqual(html_format(''), '')120 self.assertHTMLEqual(html_format('Content'), '<p>Content</p>')121 self.assertEqual(html_format('Content</p>'), 'Content</p>')122 self.assertHTMLEqual(123 html_format('Hello\nworld!'),124 '<p>Hello<br />world!</p>'125 )126 @skip_if_lib_not_available('textile')127 def test_html_content_textitle(self):128 markups.MARKUP_LANGUAGE = 'textile'129 value = 'Hello world !\n\n' \130 'this is my content :\n\n' \131 '* Item 1\n* Item 2'132 self.assertHTMLEqual(133 html_format(value),134 '\t<p>Hello world !</p>\n\n\t'135 '<p>this is my content :</p>\n\n\t'136 '<ul>\n\t\t<li>Item 1</li>\n\t\t'137 '<li>Item 2</li>\n\t</ul>'138 )139 @skip_if_lib_not_available('markdown')140 def test_html_content_markdown(self):141 markups.MARKUP_LANGUAGE = 'markdown'142 value = 'Hello world !\n\n' \143 'this is my content :\n\n' \144 '* Item 1\n* Item 2'145 self.assertHTMLEqual(146 html_format(value),147 '<p>Hello world !</p>\n'148 '<p>this is my content :</p>'149 '\n<ul>\n<li>Item 1</li>\n'150 '<li>Item 2</li>\n</ul>'151 )152 @skip_if_lib_not_available('docutils')153 def test_html_content_restructuredtext(self):154 markups.MARKUP_LANGUAGE = 'restructuredtext'155 value = 'Hello world !\n\n' \156 'this is my content :\n\n' \157 '* Item 1\n* Item 2'158 self.assertHTMLEqual(159 html_format(value),160 '<p>Hello world !</p>\n'161 '<p>this is my content :</p>'162 '\n<ul class="simple">\n<li>Item 1</li>\n'163 '<li>Item 2</li>\n</ul>\n'...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pytest-django automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful