Skip to content

Commit

Permalink
Merge pull request #8 from Som-Energia/REMOVE_prettify
Browse files Browse the repository at this point in the history
Remove prettify after changing editor to TinyMCE
  • Loading branch information
MariteSomEnergia committed Sep 21, 2022
2 parents 43b5dbf + d79d9e0 commit 3a84b77
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tests/test_edits.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async def test_save_user_edit_by_type(self, test_app):
result = await save_user_edit(template_id=1, user_id=1, edit=edit)
assert result
current_edit = await get_edit_orm(1)
assert current_edit.body_text == 'New text\n\n'
assert current_edit.body_text == 'New text\n'
assert current_edit.headers == "{'def_subject':'new_subject'}"

async def test_delete_user_edit(self, test_app):
Expand Down
11 changes: 5 additions & 6 deletions tests/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,16 @@ def test__xml_id_validator__ok(valid_xml_id):

PYTHON_PART = ('python', '<%\nfor a in [1,2]:\n\tprint(a)\n%>')
PYTHON_INLINE = ('python', ' % if a:')
HTML_PART =('html', '<p>text</p><p><b>Bold text</b></p>')
PRETTY_HTML = '<p>\n text\n</p>\n<p>\n <b>\n Bold text\n </b>\n</p>\n'
HTML_PART =('html', '<p>\n text\n</p>\n<p>\n <b>\n Bold text\n </b>\n</p>\n')
@pytest.mark.parametrize(
"input,expected", [ pytest.param(*x[1:], id=x[0]) for x in [
('empty', [], "full text"),
('python', [PYTHON_PART], PYTHON_PART[1]+'\n'),
('html', [HTML_PART], PRETTY_HTML),
('python_html',[PYTHON_PART, HTML_PART], PYTHON_PART[1]+'\n' + PRETTY_HTML),
('python', [PYTHON_PART], PYTHON_PART[1] + '\n'),
('html', [HTML_PART], HTML_PART[1] + '\n'),
('python_html',[PYTHON_PART, HTML_PART], PYTHON_PART[1] + '\n' + HTML_PART[1] + '\n'),
('python_html_inline_python',
[PYTHON_PART, HTML_PART, PYTHON_INLINE, HTML_PART],
PYTHON_PART[1] + '\n' + PRETTY_HTML + PYTHON_INLINE[1] + '\n' + PRETTY_HTML
PYTHON_PART[1] + '\n' + HTML_PART[1] + '\n' + PYTHON_INLINE[1] + '\n' + HTML_PART[1] + '\n'
),
]])
def test_compose_text_types(input, expected):
Expand Down
4 changes: 0 additions & 4 deletions uiqmako_api/schemas/edits.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,5 @@ def compose_text_types(self):
if self.by_type:
full_text = ''
for type, text in self.by_type:
if type == 'html':
text = BeautifulSoup(
text, "html.parser"
).prettify(formatter=None)
full_text += text + '\n'
self.def_body_text = full_text

1 comment on commit 3a84b77

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests Skipped Failures Errors Time
98 6 💤 0 ❌ 0 🔥 1m 33s ⏱️

Please sign in to comment.