def test_get_unknown_invited_user_returns_none(notify_db, notify_db_session, sample_service): unknown_id = uuid.uuid4() with pytest.raises(NoResultFound) as e: get_invited_user(sample_service.id, unknown_id) assert 'No row was found for one()' in str(e.value)
def update_invited_user(service_id, invited_user_id): fetched = get_invited_user(service_id=service_id, invited_user_id=invited_user_id) current_data = dict(invited_user_schema.dump(fetched).data.items()) current_data.update(request.get_json()) update_dict = invited_user_schema.load(current_data).data save_invited_user(update_dict) return jsonify(data=invited_user_schema.dump(fetched).data), 200
def test_get_invited_user_by_service_and_id(notify_db, notify_db_session, sample_invited_user): from_db = get_invited_user(sample_invited_user.service.id, sample_invited_user.id) assert from_db == sample_invited_user
def get_invited_user_by_service(service_id, invited_user_id): invited_user = get_invited_user(service_id, invited_user_id) return jsonify(data=invited_user_schema.dump(invited_user).data), 200