def test_raises_HTTPConflict_from_DuplicateUserError( self, pyramid_request, user_unique_service): user_unique_service.ensure_unique.side_effect = DuplicateUserError( "nope") with pytest.raises(HTTPConflict): create(pyramid_request)
def test_raises_HTTPConflict_from_DuplicateUserError( self, valid_payload, pyramid_request, user_unique_svc): pyramid_request.json_body = valid_payload user_unique_svc.ensure_unique.side_effect = DuplicateUserError("nope") with pytest.raises(HTTPConflict) as exc: create(pyramid_request) assert "nope" in str(exc.value)
def test_raises_conflict_error_from_duplicate_user_error( self, valid_payload, pyramid_request, user_unique_svc): pyramid_request.json_body = valid_payload user_unique_svc.ensure_unique.side_effect = DuplicateUserError('nope') with pytest.raises(ConflictError) as exc: create(pyramid_request) assert 'nope' in str(exc.value)