Skip to content

Commit 69870d6

Browse files
adds rocket route tests
1 parent 117ce0b commit 69870d6

File tree

7 files changed

+687
-16
lines changed

7 files changed

+687
-16
lines changed

lib/controllers/flight.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ async def get_rocketpy_flight_binary(
183183

184184
@classmethod
185185
async def update_flight_by_id(
186-
cls, flight: Flight, flight_id: str
186+
cls, flight_id: str, flight: Flight
187187
) -> Union[FlightUpdated, HTTPException]:
188188
"""
189189
Update a models.Flight in the database.

lib/controllers/rocket.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ async def get_rocketpy_rocket_binary(
170170

171171
@classmethod
172172
async def update_rocket_by_id(
173-
cls, rocket: Rocket, rocket_id: str
173+
cls, rocket_id: str, rocket: Rocket
174174
) -> Union[RocketUpdated, HTTPException]:
175175
"""
176176
Update a models.Rocket in the database.

lib/models/aerosurfaces.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
from enum import Enum
2-
from typing import Optional, Tuple, List
2+
from typing import Optional, Tuple, List, Union
33
from pydantic import BaseModel
44

55

6+
class Parachute(BaseModel):
7+
name: str
8+
cd_s: float
9+
sampling_rate: int
10+
lag: float
11+
trigger: Union[str, float]
12+
noise: Tuple[float, float, float]
13+
14+
615
class RailButtons(BaseModel):
716
name: str = "RailButtons"
817
upper_button_position: float

lib/models/rocket.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
NoseCone,
88
Tail,
99
RailButtons,
10+
Parachute,
1011
)
1112

1213

@@ -15,15 +16,6 @@ class CoordinateSystemOrientation(str, Enum):
1516
NOSE_TO_TAIL: str = "NOSE_TO_TAIL"
1617

1718

18-
class Parachute(BaseModel):
19-
name: str
20-
cd_s: float
21-
sampling_rate: int
22-
lag: float
23-
trigger: Union[str, float]
24-
noise: Tuple[float, float, float]
25-
26-
2719
class Rocket(BaseModel):
2820
# Required parameters
2921
motor: Motor

lib/routes/flight.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ async def read_flight(flight_id: str) -> FlightView:
5959

6060

6161
@router.get(
62-
"/rocketpy/{flight_id}",
62+
"/{flight_id}/rocketpy",
6363
responses={
6464
203: {
6565
"description": "Binary file download",
@@ -146,7 +146,7 @@ async def update_flight(
146146
"""
147147
with tracer.start_as_current_span("update_flight"):
148148
flight.rocket.motor.set_motor_kind(motor_kind)
149-
return await FlightController.update_flight_by_id(flight, flight_id)
149+
return await FlightController.update_flight_by_id(flight_id, flight)
150150

151151

152152
@router.get("/{flight_id}/summary")

lib/routes/rocket.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ async def update_rocket(
7373
"""
7474
with tracer.start_as_current_span("update_rocket"):
7575
rocket.motor.set_motor_kind(motor_kind)
76-
return await RocketController.update_rocket_by_id(rocket, rocket_id)
76+
return await RocketController.update_rocket_by_id(rocket_id, rocket)
7777

7878

7979
@router.get(
80-
"/rocketpy/{rocket_id}",
80+
"/{rocket_id}/rocketpy",
8181
responses={
8282
203: {
8383
"description": "Binary file download",

0 commit comments

Comments
 (0)