6767from openfga_sdk .models .write_authorization_model_response import WriteAuthorizationModelResponse
6868from openfga_sdk .models .write_request import WriteRequest
6969
70- store_id = 'd12345abc '
70+ store_id = '01H0H015178Y2V4CX10C2KGHF4 '
7171request_id = 'x1y2z3'
7272
7373# Helper function to construct mock response
@@ -134,7 +134,7 @@ async def test_check(self, mock_request):
134134 # Make sure the API was called with the right data
135135 mock_request .assert_called_once_with (
136136 'POST' ,
137- 'http://api.fga.example/stores/d12345abc /check' ,
137+ 'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4 /check' ,
138138 headers = ANY ,
139139 query_params = [],
140140 post_params = [],
@@ -197,7 +197,7 @@ async def test_delete_store(self, mock_request):
197197 await api_instance .delete_store ()
198198 mock_request .assert_called_once_with (
199199 'DELETE' ,
200- 'http://api.fga.example/stores/d12345abc ' ,
200+ 'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4 ' ,
201201 headers = ANY ,
202202 query_params = [],
203203 body = None ,
@@ -239,7 +239,7 @@ async def test_expand(self, mock_request):
239239 self .assertEqual (api_response , expected_response )
240240 mock_request .assert_called_once_with (
241241 'POST' ,
242- 'http://api.fga.example/stores/d12345abc /expand' ,
242+ 'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4 /expand' ,
243243 headers = ANY ,
244244 query_params = [],
245245 post_params = [],
@@ -257,7 +257,7 @@ async def test_get_store(self, mock_request):
257257 Get a store # noqa: E501
258258 """
259259 response_body = '''{
260- "id": "d12345abc ",
260+ "id": "01H0H015178Y2V4CX10C2KGHF4 ",
261261 "name": "test_store",
262262 "created_at": "2022-07-25T20:45:10.485Z",
263263 "updated_at": "2022-07-25T20:45:10.485Z"
@@ -271,11 +271,11 @@ async def test_get_store(self, mock_request):
271271 # Get a store
272272 api_response = await api_instance .get_store ()
273273 self .assertIsInstance (api_response , GetStoreResponse )
274- self .assertEqual (api_response .id , 'd12345abc ' )
274+ self .assertEqual (api_response .id , '01H0H015178Y2V4CX10C2KGHF4 ' )
275275 self .assertEqual (api_response .name , 'test_store' )
276276 mock_request .assert_called_once_with (
277277 'GET' ,
278- 'http://api.fga.example/stores/d12345abc ' ,
278+ 'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4 ' ,
279279 headers = ANY ,
280280 query_params = [],
281281 _preload_content = ANY ,
@@ -313,7 +313,7 @@ async def test_list_objects(self, mock_request):
313313 self .assertEqual (api_response .objects , ['document:abcd1234' ])
314314 mock_request .assert_called_once_with (
315315 'POST' ,
316- 'http://api.fga.example/stores/d12345abc /list-objects' ,
316+ 'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4 /list-objects' ,
317317 headers = ANY ,
318318 query_params = [],
319319 post_params = [],
@@ -436,7 +436,7 @@ async def test_read(self, mock_request):
436436 self .assertEqual (api_response , expected_data )
437437 mock_request .assert_called_once_with (
438438 'POST' ,
439- 'http://api.fga.example/stores/d12345abc /read' ,
439+ 'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4 /read' ,
440440 headers = ANY ,
441441 query_params = [],
442442 post_params = [],
@@ -488,7 +488,7 @@ async def test_read_assertions(self, mock_request):
488488 self .assertEqual (api_response .assertions , [assertion ])
489489 mock_request .assert_called_once_with (
490490 'GET' ,
491- 'http://api.fga.example/stores/d12345abc /assertions/01G5JAVJ41T49E9TT3SKVS7X1J' ,
491+ 'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4 /assertions/01G5JAVJ41T49E9TT3SKVS7X1J' ,
492492 headers = ANY ,
493493 query_params = [],
494494 _preload_content = ANY ,
@@ -573,7 +573,7 @@ async def test_read_authorization_model(self, mock_request):
573573 self .assertEqual (api_response .authorization_model , authorization_model )
574574 mock_request .assert_called_once_with (
575575 'GET' ,
576- 'http://api.fga.example/stores/d12345abc /authorization-models/01G5JAVJ41T49E9TT3SKVS7X1J' ,
576+ 'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4 /authorization-models/01G5JAVJ41T49E9TT3SKVS7X1J' ,
577577 headers = ANY ,
578578 query_params = [],
579579 _preload_content = ANY ,
@@ -628,7 +628,7 @@ async def test_read_changes(self, mock_request):
628628 self .assertEqual (api_response , read_changes )
629629 mock_request .assert_called_once_with (
630630 'GET' ,
631- 'http://api.fga.example/stores/d12345abc /changes' ,
631+ 'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4 /changes' ,
632632 headers = ANY ,
633633 query_params = [('type' , 'document' ), ('page_size' , 1 ),
634634 ('continuation_token' , 'abcdefg' )],
@@ -670,7 +670,7 @@ async def test_write(self, mock_request):
670670 )
671671 mock_request .assert_called_once_with (
672672 'POST' ,
673- 'http://api.fga.example/stores/d12345abc /write' ,
673+ 'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4 /write' ,
674674 headers = ANY ,
675675 query_params = [],
676676 post_params = [],
@@ -714,7 +714,7 @@ async def test_write_delete(self, mock_request):
714714 )
715715 mock_request .assert_called_once_with (
716716 'POST' ,
717- 'http://api.fga.example/stores/d12345abc /write' ,
717+ 'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4 /write' ,
718718 headers = ANY ,
719719 query_params = [],
720720 post_params = [],
@@ -759,7 +759,7 @@ async def test_write_assertions(self, mock_request):
759759 )
760760 mock_request .assert_called_once_with (
761761 'PUT' ,
762- 'http://api.fga.example/stores/d12345abc /assertions/xyz0123' ,
762+ 'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4 /assertions/xyz0123' ,
763763 headers = ANY ,
764764 query_params = [],
765765 post_params = [],
@@ -819,7 +819,7 @@ async def test_write_authorization_model(self, mock_request):
819819 self .assertEqual (api_response , expected_response )
820820 mock_request .assert_called_once_with (
821821 'POST' ,
822- 'http://api.fga.example/stores/d12345abc /authorization-models' ,
822+ 'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4 /authorization-models' ,
823823 headers = ANY ,
824824 query_params = [],
825825 post_params = [],
@@ -906,6 +906,17 @@ def test_configuration_has_query(self):
906906 )
907907 self .assertRaises (ApiValueError , configuration .is_valid )
908908
909+ def test_configuration_store_id_invalid (self ):
910+ """
911+ Test whether ApiValueError is raised if host has query
912+ """
913+ configuration = openfga_sdk .Configuration (
914+ api_host = 'localhost' ,
915+ api_scheme = 'http' ,
916+ store_id = "abcd"
917+ )
918+ self .assertRaises (FgaValidationException , configuration .is_valid )
919+
909920 async def test_bad_configuration_read_authorization_model (self ):
910921 """
911922 Test whether FgaValidationException is raised for API (reading authorization models)
@@ -1166,7 +1177,7 @@ async def test_check_api_token(self, mock_request):
11661177 {'Accept' : 'application/json' , 'Content-Type' : 'application/json' , 'User-Agent' : 'openfga-sdk python/0.1.1' , 'Authorization' : 'Bearer TOKEN1' })
11671178 mock_request .assert_called_once_with (
11681179 'POST' ,
1169- 'http://api.fga.example/stores/d12345abc /check' ,
1180+ 'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4 /check' ,
11701181 headers = expectedHeader ,
11711182 query_params = [],
11721183 post_params = [],
@@ -1209,7 +1220,7 @@ async def test_check_custom_header(self, mock_request):
12091220 {'Accept' : 'application/json' , 'Content-Type' : 'application/json' , 'User-Agent' : 'openfga-sdk python/0.1.1' , 'Custom Header' : 'custom value' })
12101221 mock_request .assert_called_once_with (
12111222 'POST' ,
1212- 'http://api.fga.example/stores/d12345abc /check' ,
1223+ 'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4 /check' ,
12131224 headers = expectedHeader ,
12141225 query_params = [],
12151226 post_params = [],
0 commit comments