def test_it_raises_if_validate_raises(self, pyramid_request, schemas): schemas.CreateAnnotationSchema.return_value.validate.side_effect = ( ValidationError('asplode')) with pytest.raises(ValidationError) as exc: views.create(pyramid_request) assert exc.value.message == 'asplode'
def test_it_raises_if_create_annotation_raises(self, pyramid_request, storage): storage.create_annotation.side_effect = ValidationError('asplode') with pytest.raises(ValidationError) as exc: views.create(pyramid_request) assert exc.value.message == 'asplode'
def test_it_raises_if_storage_raises(self, pyramid_request, storage): storage.update_annotation.side_effect = ValidationError('asplode') with pytest.raises(ValidationError): views.update(mock.Mock(), pyramid_request)
def test_it_raises_if_validate_raises(self, pyramid_request, schemas): schemas.UpdateAnnotationSchema.return_value.validate\ .side_effect = ValidationError('asplode') with pytest.raises(ValidationError): views.update(mock.Mock(), pyramid_request)