|
| 1 | +# Copyright 2025 Planet Labs PBC. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 4 | +# use this file except in compliance with the License. You may obtain a copy of |
| 5 | +# the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | +# License for the specific language governing permissions and limitations under |
| 13 | +# the License. |
| 14 | +"""Tests for the synchronous Planet client.""" |
| 15 | + |
| 16 | +from planet.sync import Planet |
| 17 | + |
| 18 | + |
| 19 | +class TestPlanetSyncClient: |
| 20 | + """Test cases for the Planet synchronous client.""" |
| 21 | + |
| 22 | + def test_planet_default_initialization(self): |
| 23 | + """Test that Planet client initializes correctly with defaults.""" |
| 24 | + pl = Planet() |
| 25 | + |
| 26 | + assert pl.data is not None |
| 27 | + assert pl.data._client._base_url == "https://api.planet.com/data/v1" |
| 28 | + |
| 29 | + assert pl.orders is not None |
| 30 | + assert pl.orders._client._base_url == "https://api.planet.com/compute/ops" |
| 31 | + |
| 32 | + assert pl.subscriptions is not None |
| 33 | + assert pl.subscriptions._client._base_url == "https://api.planet.com/subscriptions/v1" |
| 34 | + |
| 35 | + assert pl.features is not None |
| 36 | + assert pl.features._client._base_url == "https://api.planet.com/features/v1/ogc/my" |
| 37 | + |
| 38 | + def test_planet_custom_base_url_initialization(self): |
| 39 | + """Test that Planet client accepts custom base URL.""" |
| 40 | + pl = Planet(base_url="https://custom.planet.com") |
| 41 | + |
| 42 | + assert pl.data is not None |
| 43 | + assert pl.data._client._base_url == "https://custom.planet.com/data/v1" |
| 44 | + |
| 45 | + assert pl.orders is not None |
| 46 | + assert pl.orders._client._base_url == "https://custom.planet.com/compute/ops" |
| 47 | + |
| 48 | + assert pl.subscriptions is not None |
| 49 | + assert pl.subscriptions._client._base_url == "https://custom.planet.com/subscriptions/v1" |
| 50 | + |
| 51 | + assert pl.features is not None |
| 52 | + assert pl.features._client._base_url == "https://custom.planet.com/features/v1/ogc/my" |
0 commit comments