1
+ #!/usr/bin/env python3
2
+ """Simple test to verify base URL functionality works correctly."""
3
+
4
+ import sys
5
+ import os
6
+ sys .path .insert (0 , os .path .abspath ('.' ))
7
+
8
+ from planet .sync import Planet
9
+
10
+ def test_planet_base_url_configuration ():
11
+ """Test that Planet client accepts and uses custom base URLs."""
12
+
13
+ # Test with custom base URLs
14
+ custom_data_url = "https://custom-data.planet.com"
15
+ custom_orders_url = "https://custom-orders.planet.com"
16
+ custom_subscriptions_url = "https://custom-subscriptions.planet.com"
17
+ custom_features_url = "https://custom-features.planet.com"
18
+
19
+ # Create Planet client with custom base URLs
20
+ pl = Planet (
21
+ data_base_url = custom_data_url ,
22
+ orders_base_url = custom_orders_url ,
23
+ subscriptions_base_url = custom_subscriptions_url ,
24
+ features_base_url = custom_features_url
25
+ )
26
+
27
+ # Verify the base URLs are correctly set
28
+ assert pl .data ._client ._base_url == custom_data_url
29
+ assert pl .orders ._client ._base_url == custom_orders_url
30
+ assert pl .subscriptions ._client ._base_url == custom_subscriptions_url
31
+ assert pl .features ._client ._base_url == custom_features_url
32
+
33
+ print ("✓ All custom base URLs are correctly set" )
34
+
35
+ def test_planet_default_base_urls ():
36
+ """Test that Planet client uses default base URLs when none provided."""
37
+
38
+ # Create Planet client with defaults
39
+ pl = Planet ()
40
+
41
+ # Verify default base URLs are used
42
+ assert "https://api.planet.com/data/v1" in pl .data ._client ._base_url
43
+ assert "https://api.planet.com/compute/ops" in pl .orders ._client ._base_url
44
+ assert "https://api.planet.com/subscriptions/v1" in pl .subscriptions ._client ._base_url
45
+ assert "https://api.planet.com/features/v1/ogc/my" in pl .features ._client ._base_url
46
+
47
+ print ("✓ All default base URLs are correctly set" )
48
+
49
+ if __name__ == "__main__" :
50
+ test_planet_base_url_configuration ()
51
+ test_planet_default_base_urls ()
52
+ print ("All tests passed! 🎉" )
0 commit comments