Skip to content

Commit

Permalink
quality: ensure long line notice is not included when not applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
ublefo committed Apr 20, 2024
1 parent cf6a2fa commit 99cf479
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/models/task_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,29 @@ def test_code_submission_with_long_lines
reader = PDF::Reader.new(task.final_pdf_path)
assert reader.pages[1].text.include? "This file has additional line breaks applied"

# submit a normal file and ensure the notice is not included in the PDF
data_to_post = {
trigger: 'ready_for_feedback'
}

data_to_post = with_file('test_files/submissions/normal.py', 'application/json', data_to_post)
project = unit.active_projects.first
add_auth_header_for user: unit.main_convenor_user
post "/api/projects/#{project.id}/task_def_id/#{td.id}/submission", data_to_post
assert_equal 201, last_response.status, last_response_body

# test submission generation
task = project.task_for_task_definition(td)
assert task.convert_submission_to_pdf
path = task.zip_file_path_for_done_task
assert path
assert File.exist? path
assert File.exist? task.final_pdf_path

# ensure the notice is not included
reader = PDF::Reader.new(task.final_pdf_path)
assert_not reader.pages[1].text.include? "This file has additional line breaks applied"

td.destroy
assert_not File.exist? path
unit.destroy!
Expand Down
1 change: 1 addition & 0 deletions test_files/submissions/normal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello World")

0 comments on commit 99cf479

Please sign in to comment.