Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Updated tests to work with new models
Browse files Browse the repository at this point in the history
Fixed query for csce section test
  • Loading branch information
rachelconn authored and gannonprudhomme committed Feb 5, 2020
1 parent 31250d2 commit 66cd8fb
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions autoscheduler/scraper/tests/commands/scrape_courses_tests.py
Expand Up @@ -31,6 +31,7 @@ def test_parse_section_does_save_model(self):
course_num = "121"
section_num = "501"
term_code = 202011
crn = 12323
min_credits = 4
max_enroll = curr_enroll = 22
section_id = 497223
Expand All @@ -48,7 +49,7 @@ def test_parse_section_does_save_model(self):
# model wasn't saved correctly

Section.objects.get(id=section_id, subject=subject, course_num=course_num,
section_num=section_num, term_code=term_code,
section_num=section_num, term_code=term_code, crn=crn,
current_enrollment=curr_enroll, min_credits=min_credits,
max_enrollment=max_enroll, instructor=fake_instructor)

Expand Down Expand Up @@ -90,7 +91,7 @@ def test_parse_meeting_does_save_model_correct(self):

# Course num is gonna be a character field
section = Section(id=497223, subject="CSCE", course_num=121, section_num=501,
term_code=0, min_credits=0, current_enrollment=0,
term_code=0, crn=crn, min_credits=0, current_enrollment=0,
max_enrollment=0, instructor=instructor)
section.save() # Must be saved for the assert query to work

Expand All @@ -100,9 +101,9 @@ def test_parse_meeting_does_save_model_correct(self):
# Assert
# If parse_meeting doesn't save the model correctly, then this query
# will throw an error, thus failing the test
Meeting.objects.get(id=meeting_id, crn=crn, building=building,
meeting_days=meeting_days, start_time=begin_time,
end_time=end_time, meeting_type=meeting_type, section=section)
Meeting.objects.get(id=meeting_id, building=building, meeting_days=meeting_days,
start_time=begin_time, end_time=end_time,
meeting_type=meeting_type, section=section)

def test_parse_instructor_does_save_model(self):
""" Tests if parse instructor saves the model to the database correctly """
Expand Down Expand Up @@ -169,15 +170,15 @@ def test_parse_course_fills_instructor_and_meeting(self):
meeting_type = "LEC"
meeting_days = [True, False, True, False, True, False, False]
section = Section(id=497223, subject="CSCE", course_num=121, section_num=501,
term_code=0, min_credits=0, current_enrollment=0,
term_code=0, crn=crn, min_credits=0, current_enrollment=0,
max_enrollment=0, instructor=instructor)

#Act
parse_course(self.csce_section_json)

# Assert
Instructor.objects.get(id=instructor_id, email_address=instructor_email)
Meeting.objects.get(id=meeting_id, crn=crn, building=building,
Meeting.objects.get(id=meeting_id, building=building,
meeting_days=meeting_days, start_time=begin_time,
end_time=end_time, meeting_type=meeting_type, section=section)

Expand All @@ -189,6 +190,7 @@ def test_parse_section_handles_alphanumeric_section_num(self):
course_num = "210"
section_num = "M99"
term_code = 202011
crn = 36167
min_credits = 3
max_enroll = 25
curr_enroll = 3
Expand All @@ -203,7 +205,7 @@ def test_parse_section_handles_alphanumeric_section_num(self):

# Assert
Section.objects.get(id=section_id, subject=subject, course_num=course_num,
section_num=section_num, term_code=term_code,
section_num=section_num, term_code=term_code, crn=crn,
current_enrollment=curr_enroll, min_credits=min_credits,
max_enrollment=max_enroll, instructor=fake_instructor)

Expand Down

0 comments on commit 66cd8fb

Please sign in to comment.