Ejemplo n.º 1
0
 def test_fail(self, mock_course_presistence):
     course_api = CourseApi(mock_course_presistence)
     section = fake_section()
     err = Err(fake.pystr())
     mock_course_presistence.create_section = MagicMock(return_value=err)
     assert (course_api.create_section(
         section.course,
         section.year,
         section.semester,
         section.section_code,
         section.taught_by,
         section.num_students,
     ) == err)
     mock_course_presistence.create_section.assert_called_once_with(section)
Ejemplo n.º 2
0
 def test_success(self, mock_course_presistence):
     course_api = CourseApi(mock_course_presistence)
     section = fake_section()
     mock_course_presistence.create_section = MagicMock(
         return_value=Ok(section))
     assert (course_api.create_section(
         section.course,
         section.year,
         section.semester,
         section.section_code,
         section.taught_by,
         section.num_students,
     ).unwrap() == section)
     mock_course_presistence.create_section.assert_called_once_with(section)