3030 ProviderRole ,
3131)
3232
33+ from models import (
34+ PlanetProductConstraints ,
35+ PlanetOpportunityProperties ,
36+ PlanetOrderParameters ,
37+ provider_planet
38+ )
39+
3340from backends import (
3441 mock_create_order ,
3542 mock_get_opportunity_collection ,
@@ -90,38 +97,9 @@ def put_opportunity_collection(self, collection: OpportunityCollection) -> None:
9097
9198
9299
93- class MyProductConstraints (BaseModel ):
94- off_nadir : int
95-
96-
97- class OffNadirRange (BaseModel ):
98- minimum : int = Field (ge = 0 , le = 45 )
99- maximum : int = Field (ge = 0 , le = 45 )
100-
101- @model_validator (mode = "after" )
102- def validate_range (self ) -> Self :
103- if self .minimum > self .maximum :
104- raise ValueError ("range minimum cannot be greater than maximum" )
105- return self
106-
107100
108- class MyOpportunityProperties (OpportunityProperties ):
109- off_nadir : OffNadirRange
110- vehicle_id : list [Literal [1 , 2 , 5 , 7 , 8 ]]
111- platform : Literal ["platform_id" ]
112101
113102
114- class MyOrderParameters (OrderParameters ):
115- s3_path : str | None = None
116-
117-
118- provider_planet = Provider (
119- name = "Planet" ,
120- description = "A provider for Test data" ,
121- roles = [ProviderRole .producer ], # Example role
122- url = "https://www.planet.com" , # Must be a valid URL
123- )
124-
125103
126104product_test_planet_sync_opportunity = Product (
127105 id = "INT-003001:Assured Tasking" ,
@@ -135,31 +113,8 @@ class MyOrderParameters(OrderParameters):
135113 search_opportunities = search_opportunities ,
136114 search_opportunities_async = None ,
137115 get_opportunity_collection = None ,
138- constraints = MyProductConstraints ,
139- opportunity_properties = MyOpportunityProperties ,
140- order_parameters = MyOrderParameters ,
116+ constraints = PlanetProductConstraints ,
117+ opportunity_properties = PlanetOpportunityProperties ,
118+ order_parameters = PlanetOrderParameters ,
141119)
142120
143-
144- def create_mock_opportunity () -> Opportunity :
145- now = datetime .now (timezone .utc ) # Use timezone-aware datetime
146- start = now
147- end = start + timedelta (days = 5 )
148-
149- # Create a list of mock opportunities for the given product
150- return Opportunity (
151- id = str (uuid4 ()),
152- type = "Feature" ,
153- geometry = Point (
154- type = "Point" ,
155- coordinates = Position2D (longitude = 0.0 , latitude = 0.0 ),
156- ),
157- properties = MyOpportunityProperties (
158- product_id = "xyz123" ,
159- datetime = (start , end ),
160- off_nadir = OffNadirRange (minimum = 20 , maximum = 22 ),
161- vehicle_id = [1 ],
162- platform = "platform_id" ,
163- other_thing = "abcd1234" , # type: ignore
164- ),
165- )
0 commit comments