Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
kjw142857 authored Sep 15, 2023
1 parent ae0c564 commit 2748d8c
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions test/cadet/assessments/assessments_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,19 @@ defmodule Cadet.AssessmentsTest do

describe "contest voting" do
test "inserts votes into submission_votes table" do
contest_question = insert(:programming_question)
contest_assessment = contest_question.assessment
course = contest_question.assessment.course
course = insert(:course)
config = insert(:assessment_config)
# contest assessment that has closed
contest_assessment =
insert(:assessment,
is_published: true,
open_at: Timex.shift(Timex.now(), days: -5),
close_at: Timex.shift(Timex.now(), hours: -1),
course: course,
config: config
)

contest_question = insert(:programming_question, assessment: contest_assessment)
voting_assessment = insert(:assessment, %{course: course})

question =
Expand Down Expand Up @@ -225,18 +235,20 @@ defmodule Cadet.AssessmentsTest do
end

test "deletes submission_votes when assessment is deleted" do
contest_question = insert(:programming_question)
course = contest_question.assessment.course
config = contest_question.assessment.config

voting_assessment =
insert(:assessment, %{
course: course,
config: config,
course = insert(:course)
config = insert(:assessment_config)
# contest assessment that has closed
contest_assessment =
insert(:assessment,
is_published: true,
open_at: Timex.shift(Timex.now(), days: -5),
close_at: Timex.shift(Timex.now(), hours: -1)
})
close_at: Timex.shift(Timex.now(), hours: -1),
course: course,
config: config
)

contest_question = insert(:programming_question, assessment: contest_assessment)
voting_assessment = insert(:assessment, %{course: course, config: config})
question = insert(:voting_question, assessment: voting_assessment)
students = insert_list(5, :course_registration, %{role: :student, course: course})

Expand Down

0 comments on commit 2748d8c

Please sign in to comment.