Skip to content

Commit

Permalink
Make linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
klkvr committed Dec 7, 2023
1 parent 9e1090b commit 698bb73
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions anytask/issues/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,9 @@ def set_field_comment(self, author, course, event, value):
if self.task.rb_integrated \
and (course.send_rb_and_contest_together or not self.task.contest_integrated):
self.set_field_comment_rb_integrated(course, event, file, value)

if not value['files'] and not value['comment']:
return True, None # Do not include empty comments
return True, None # Do not include empty comments
else:
self.update_time = timezone.now()
value = u'<div class="issue-page-comment not-sanitize">' + value['comment'] + u'</div>'
Expand Down
21 changes: 10 additions & 11 deletions anytask/issues/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,13 +751,13 @@ def test_comment_with_student(self):
self.assertEqual(history[0].find('div', 'history-body').find('div', 'not-sanitize').string.strip().strip('\n'),
'test_comment',
'Wrong comment text')

def _extract_history_from_response(self, issue_page_response):
html = BeautifulSoup(issue_page_response.content)
container = html.body.find('div', 'container', recursive=False)
history = container.find('ul', 'history')('li')
return history

def test_empty_comment_with_student(self):
client = self.client

Expand All @@ -769,20 +769,19 @@ def test_empty_comment_with_student(self):

# Get page before comment
response_before = client.get(reverse(issues.views.issue_page,
kwargs={'issue_id': issue.id}))
kwargs={'issue_id': issue.id}))

# post
response_after = client.post(reverse(issues.views.upload),
{'comment': '',
'files[]': '',
'issue_id': str(issue.id),
'form_name': 'comment_form',
'update_issue': ''}, follow=True)

{'comment': '',
'files[]': '',
'issue_id': str(issue.id),
'form_name': 'comment_form',
'update_issue': ''}, follow=True)

history_before = self._extract_history_from_response(response_before)
history_after = self._extract_history_from_response(response_after)

self.assertEqual(history_before, history_after, 'History changed after empty comment')

def test_deadline(self):
Expand Down

0 comments on commit 698bb73

Please sign in to comment.