Ejemplo n.º 1
0
 def test_fail(self, mock_course_presistence):
     course_api = CourseApi(mock_course_presistence)
     course = fake_course()
     err = Err(fake.pystr())
     mock_course_presistence.create_course = MagicMock(return_value=err)
     assert course_api.create_course(course.course_code) == err
     mock_course_presistence.create_course.assert_called_once_with(course)
Ejemplo n.º 2
0
 def test_success(self, mock_course_presistence):
     course_api = CourseApi(mock_course_presistence)
     course = fake_course()
     mock_course_presistence.create_course = MagicMock(
         return_value=Ok(course))
     assert course_api.create_course(course.course_code).unwrap() == course
     mock_course_presistence.create_course.assert_called_once_with(course)