[API] minor fix
This commit is contained in:
		@@ -1112,7 +1112,6 @@ class TestUserPicture(ApiTestCaseMixin):
 | 
				
			|||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        data = json.loads(response.data.decode())
 | 
					        data = json.loads(response.data.decode())
 | 
				
			||||||
        print('data', data)
 | 
					 | 
				
			||||||
        assert response.status_code == 413
 | 
					        assert response.status_code == 413
 | 
				
			||||||
        assert 'fail' in data['status']
 | 
					        assert 'fail' in data['status']
 | 
				
			||||||
        assert (
 | 
					        assert (
 | 
				
			||||||
@@ -1144,7 +1143,6 @@ class TestUserPicture(ApiTestCaseMixin):
 | 
				
			|||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        data = json.loads(response.data.decode())
 | 
					        data = json.loads(response.data.decode())
 | 
				
			||||||
        print('data', data)
 | 
					 | 
				
			||||||
        assert response.status_code == 413
 | 
					        assert response.status_code == 413
 | 
				
			||||||
        assert 'fail' in data['status']
 | 
					        assert 'fail' in data['status']
 | 
				
			||||||
        assert (
 | 
					        assert (
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@ import json
 | 
				
			|||||||
import os
 | 
					import os
 | 
				
			||||||
import shutil
 | 
					import shutil
 | 
				
			||||||
from datetime import timedelta
 | 
					from datetime import timedelta
 | 
				
			||||||
from typing import Any, Dict, List, Optional, Tuple, Union
 | 
					from typing import Dict, List, Optional, Tuple, Union
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import requests
 | 
					import requests
 | 
				
			||||||
from flask import (
 | 
					from flask import (
 | 
				
			||||||
@@ -10,7 +10,6 @@ from flask import (
 | 
				
			|||||||
    Response,
 | 
					    Response,
 | 
				
			||||||
    current_app,
 | 
					    current_app,
 | 
				
			||||||
    request,
 | 
					    request,
 | 
				
			||||||
    send_file,
 | 
					 | 
				
			||||||
    send_from_directory,
 | 
					    send_from_directory,
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
from sqlalchemy import exc
 | 
					from sqlalchemy import exc
 | 
				
			||||||
@@ -770,7 +769,7 @@ def download_workout_gpx(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@workouts_blueprint.route('/workouts/map/<map_id>', methods=['GET'])
 | 
					@workouts_blueprint.route('/workouts/map/<map_id>', methods=['GET'])
 | 
				
			||||||
def get_map(map_id: int) -> Any:
 | 
					def get_map(map_id: int) -> Union[HttpResponse, Response]:
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    Get map image for workouts with gpx
 | 
					    Get map image for workouts with gpx
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -803,8 +802,10 @@ def get_map(map_id: int) -> Any:
 | 
				
			|||||||
        workout = Workout.query.filter_by(map_id=map_id).first()
 | 
					        workout = Workout.query.filter_by(map_id=map_id).first()
 | 
				
			||||||
        if not workout:
 | 
					        if not workout:
 | 
				
			||||||
            return NotFoundErrorResponse('Map does not exist.')
 | 
					            return NotFoundErrorResponse('Map does not exist.')
 | 
				
			||||||
        absolute_map_filepath = get_absolute_file_path(workout.map)
 | 
					        return send_from_directory(
 | 
				
			||||||
        return send_file(absolute_map_filepath)
 | 
					            current_app.config['UPLOAD_FOLDER'],
 | 
				
			||||||
 | 
					            workout.map,
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
    except Exception as e:
 | 
					    except Exception as e:
 | 
				
			||||||
        return handle_error_and_return_response(e)
 | 
					        return handle_error_and_return_response(e)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user