auto test report #39
@@ -33,6 +33,7 @@ jobs:
 | 
				
			|||||||
      working-directory: backend
 | 
					      working-directory: backend
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    - name: Upload HTML report
 | 
					    - name: Upload HTML report
 | 
				
			||||||
 | 
					      if: always()
 | 
				
			||||||
      uses: https://gitea.com/actions/upload-artifact@v3
 | 
					      uses: https://gitea.com/actions/upload-artifact@v3
 | 
				
			||||||
      with:
 | 
					      with:
 | 
				
			||||||
        name: pytest-html-report
 | 
					        name: pytest-html-report
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,13 +35,8 @@ def test_turckheim(client, request):
 | 
				
			|||||||
    result = response.json()
 | 
					    result = response.json()
 | 
				
			||||||
    landmarks = load_trip_landmarks(client, result['first_landmark_uuid'])
 | 
					    landmarks = load_trip_landmarks(client, result['first_landmark_uuid'])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Create the trip string
 | 
					    # Add details to report
 | 
				
			||||||
    trip_string = [f"{landmark.name} ({landmark.attractiveness} | {landmark.duration}) - {landmark.time_to_reach_next}" for landmark in landmarks]
 | 
					    log_trip_details(request, landmarks, result['total_time'], duration_minutes)
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    # Pass additional info to pytest for reporting
 | 
					 | 
				
			||||||
    request.node.trip_details = trip_string
 | 
					 | 
				
			||||||
    request.node.trip_duration = str(result['total_time'])
 | 
					 | 
				
			||||||
    request.node.target_duration = str(duration_minutes)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # checks :
 | 
					    # checks :
 | 
				
			||||||
    assert response.status_code == 200  # check for successful planning
 | 
					    assert response.status_code == 200  # check for successful planning
 | 
				
			||||||
@@ -52,7 +47,7 @@ def test_turckheim(client, request):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Test no. 3
 | 
					# Test no. 3
 | 
				
			||||||
def test_bellecour(client, request) :
 | 
					def test_bellecour(client, request) :
 | 
				
			||||||
    duration_minutes = 50
 | 
					    duration_minutes = 60
 | 
				
			||||||
    response = client.post(
 | 
					    response = client.post(
 | 
				
			||||||
        "/trip/new",
 | 
					        "/trip/new",
 | 
				
			||||||
        json={
 | 
					        json={
 | 
				
			||||||
@@ -64,13 +59,8 @@ def test_bellecour(client, request) :
 | 
				
			|||||||
    landmarks = load_trip_landmarks(client, result['first_landmark_uuid'])
 | 
					    landmarks = load_trip_landmarks(client, result['first_landmark_uuid'])
 | 
				
			||||||
    osm_ids = landmarks_to_osmid(landmarks)
 | 
					    osm_ids = landmarks_to_osmid(landmarks)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Create the trip string
 | 
					    # Add details to report
 | 
				
			||||||
    trip_string = [f"{landmark.name} ({landmark.attractiveness}) - {landmark.time_to_reach_next}" for landmark in landmarks]
 | 
					    log_trip_details(request, landmarks, result['total_time'], duration_minutes)
 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Pass additional info to pytest for reporting
 | 
					 | 
				
			||||||
    request.node.trip_details = trip_string
 | 
					 | 
				
			||||||
    request.node.trip_duration = str(result['total_time'])
 | 
					 | 
				
			||||||
    request.node.target_duration = str(duration_minutes)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # checks :
 | 
					    # checks :
 | 
				
			||||||
    assert response.status_code == 200  # check for successful planning
 | 
					    assert response.status_code == 200  # check for successful planning
 | 
				
			||||||
@@ -144,6 +134,15 @@ def load_trip_landmarks(client, first_uuid: str) -> List[Landmark]:
 | 
				
			|||||||
    return landmarks
 | 
					    return landmarks
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def log_trip_details(request, landmarks: List[Landmark], duration: int, target_duration: int) :
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Create the trip string
 | 
				
			||||||
 | 
					    trip_string = [f"{landmark.name} ({landmark.attractiveness} | {landmark.duration}) - {landmark.time_to_reach_next}" for landmark in landmarks]
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    # Pass additional info to pytest for reporting
 | 
				
			||||||
 | 
					    request.node.trip_details = trip_string
 | 
				
			||||||
 | 
					    request.node.trip_duration = str(duration)              # result['total_time']
 | 
				
			||||||
 | 
					    request.node.target_duration = str(target_duration)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# def test_new_trip_single_prefs(client):
 | 
					# def test_new_trip_single_prefs(client):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user