diff --git a/tests/output/dart/test/requests/search_test.dart b/tests/output/dart/test/requests/search_test.dart index 9fa2dc8917..4a6c0350d8 100644 --- a/tests/output/dart/test/requests/search_test.dart +++ b/tests/output/dart/test/requests/search_test.dart @@ -493,10 +493,10 @@ void main() { options: ClientOptions(requester: requester), ), call: (client) => client.browse( - indexName: "indexName", + indexName: "cts_e2e_browse", ), intercept: (request) { - expectPath(request.path, '/1/indexes/indexName/browse'); + expectPath(request.path, '/1/indexes/cts_e2e_browse/browse'); expect(request.method, 'post'); expectBody(request.body, """{}"""); }, @@ -1459,10 +1459,10 @@ void main() { options: ClientOptions(requester: requester), ), call: (client) => client.getSettings( - indexName: "theIndexName", + indexName: "cts_e2e_settings", ), intercept: (request) { - expectPath(request.path, '/1/indexes/theIndexName/settings'); + expectPath(request.path, '/1/indexes/cts_e2e_settings/settings'); expect(request.method, 'get'); expect(request.body, null); }, @@ -3034,14 +3034,14 @@ void main() { options: ClientOptions(requester: requester), ), call: (client) => client.setSettings( - indexName: "theIndexName", + indexName: "cts_e2e_settings", indexSettings: IndexSettings( paginationLimitedTo: 10, ), forwardToReplicas: true, ), intercept: (request) { - expectPath(request.path, '/1/indexes/theIndexName/settings'); + expectPath(request.path, '/1/indexes/cts_e2e_settings/settings'); expect(request.method, 'put'); expectParams( request.queryParameters, """{"forwardToReplicas":"true"}"""); diff --git a/tests/output/go/tests/requests/search_test.go b/tests/output/go/tests/requests/search_test.go index 8d8a165f38..57f1c4164a 100644 --- a/tests/output/go/tests/requests/search_test.go +++ b/tests/output/go/tests/requests/search_test.go @@ -428,13 +428,13 @@ func TestSearch_Browse(t *testing.T) { { name: "browse with minimal parameters", testFunc: func(t *testing.T) { - parametersStr := `{"indexName":"indexName"}` + parametersStr := `{"indexName":"cts_e2e_browse"}` req := search.ApiBrowseRequest{} require.NoError(t, json.Unmarshal([]byte(parametersStr), &req)) _, err := client.Browse(req) require.NoError(t, err) - expectedPath, err := url.QueryUnescape("/1/indexes/indexName/browse") + expectedPath, err := url.QueryUnescape("/1/indexes/cts_e2e_browse/browse") require.NoError(t, err) require.Equal(t, expectedPath, echo.path) require.Equal(t, "POST", echo.method) @@ -1594,13 +1594,13 @@ func TestSearch_GetSettings(t *testing.T) { { name: "getSettings0", testFunc: func(t *testing.T) { - parametersStr := `{"indexName":"theIndexName"}` + parametersStr := `{"indexName":"cts_e2e_settings"}` req := search.ApiGetSettingsRequest{} require.NoError(t, json.Unmarshal([]byte(parametersStr), &req)) _, err := client.GetSettings(req) require.NoError(t, err) - expectedPath, err := url.QueryUnescape("/1/indexes/theIndexName/settings") + expectedPath, err := url.QueryUnescape("/1/indexes/cts_e2e_settings/settings") require.NoError(t, err) require.Equal(t, expectedPath, echo.path) require.Equal(t, "GET", echo.method) @@ -2955,13 +2955,13 @@ func TestSearch_SetSettings(t *testing.T) { { name: "setSettings with minimal parameters", testFunc: func(t *testing.T) { - parametersStr := `{"indexName":"theIndexName","indexSettings":{"paginationLimitedTo":10},"forwardToReplicas":true}` + parametersStr := `{"indexName":"cts_e2e_settings","indexSettings":{"paginationLimitedTo":10},"forwardToReplicas":true}` req := search.ApiSetSettingsRequest{} require.NoError(t, json.Unmarshal([]byte(parametersStr), &req)) _, err := client.SetSettings(req) require.NoError(t, err) - expectedPath, err := url.QueryUnescape("/1/indexes/theIndexName/settings") + expectedPath, err := url.QueryUnescape("/1/indexes/cts_e2e_settings/settings") require.NoError(t, err) require.Equal(t, expectedPath, echo.path) require.Equal(t, "PUT", echo.method) diff --git a/tests/output/java/src/test/java/com/algolia/requests/Search.test.java b/tests/output/java/src/test/java/com/algolia/requests/Search.test.java index 64cf30d29f..663c4dfda4 100644 --- a/tests/output/java/src/test/java/com/algolia/requests/Search.test.java +++ b/tests/output/java/src/test/java/com/algolia/requests/Search.test.java @@ -656,13 +656,13 @@ void batchDictionaryEntriesTest2() { @Test @DisplayName("browse with minimal parameters") void browseTest0() { - String indexName0 = "indexName"; + String indexName0 = "cts_e2e_browse"; assertDoesNotThrow(() -> { client.browse(indexName0, Object.class); }); EchoResponse req = echo.getLastResponse(); - assertEquals("/1/indexes/indexName/browse", req.path); + assertEquals("/1/indexes/cts_e2e_browse/browse", req.path); assertEquals("POST", req.method); assertDoesNotThrow(() -> JSONAssert.assertEquals("{}", req.body, JSONCompareMode.STRICT)); } @@ -1645,13 +1645,13 @@ void getRuleTest0() { @Test @DisplayName("getSettings0") void getSettingsTest0() { - String indexName0 = "theIndexName"; + String indexName0 = "cts_e2e_settings"; assertDoesNotThrow(() -> { client.getSettings(indexName0); }); EchoResponse req = echo.getLastResponse(); - assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("/1/indexes/cts_e2e_settings/settings", req.path); assertEquals("GET", req.method); assertNull(req.body); } @@ -3692,7 +3692,7 @@ void setDictionarySettingsTest1() { @Test @DisplayName("setSettings with minimal parameters") void setSettingsTest0() { - String indexName0 = "theIndexName"; + String indexName0 = "cts_e2e_settings"; IndexSettings indexSettings0 = new IndexSettings(); { int paginationLimitedTo1 = 10; @@ -3704,7 +3704,7 @@ void setSettingsTest0() { client.setSettings(indexName0, indexSettings0, forwardToReplicas0); }); EchoResponse req = echo.getLastResponse(); - assertEquals("/1/indexes/theIndexName/settings", req.path); + assertEquals("/1/indexes/cts_e2e_settings/settings", req.path); assertEquals("PUT", req.method); assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"paginationLimitedTo\":10}", req.body, JSONCompareMode.STRICT)); diff --git a/tests/output/javascript/src/requests/search.test.ts b/tests/output/javascript/src/requests/search.test.ts index b416a1c438..589135380f 100644 --- a/tests/output/javascript/src/requests/search.test.ts +++ b/tests/output/javascript/src/requests/search.test.ts @@ -359,13 +359,26 @@ describe('batchDictionaryEntries', () => { describe('browse', () => { test('browse with minimal parameters', async () => { const req = (await client.browse({ - indexName: 'indexName', + indexName: 'cts_e2e_browse', })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/indexName/browse'); + expect(req.path).toEqual('/1/indexes/cts_e2e_browse/browse'); expect(req.method).toEqual('POST'); expect(req.data).toEqual({}); expect(req.searchParams).toStrictEqual(undefined); + + const resp = await e2eClient.browse({ indexName: 'cts_e2e_browse' }); + + const expectedBody = { + page: 0, + nbHits: 33191, + nbPages: 34, + hitsPerPage: 1000, + query: '', + params: '', + }; + + expect(expectedBody).toEqual(union(expectedBody, resp)); }); test('browse with search parameters', async () => { @@ -976,13 +989,43 @@ describe('getRule', () => { describe('getSettings', () => { test('getSettings0', async () => { const req = (await client.getSettings({ - indexName: 'theIndexName', + indexName: 'cts_e2e_settings', })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.path).toEqual('/1/indexes/cts_e2e_settings/settings'); expect(req.method).toEqual('GET'); expect(req.data).toEqual(undefined); expect(req.searchParams).toStrictEqual(undefined); + + const resp = await e2eClient.getSettings({ indexName: 'cts_e2e_settings' }); + + const expectedBody = { + minWordSizefor1Typo: 4, + minWordSizefor2Typos: 8, + hitsPerPage: 20, + maxValuesPerFacet: 100, + version: 1, + paginationLimitedTo: 10, + exactOnSingleWordQuery: 'attribute', + ranking: [ + 'typo', + 'geo', + 'words', + 'filters', + 'proximity', + 'attribute', + 'exact', + 'custom', + ], + separatorsToIndex: '', + removeWordsIfNoResults: 'none', + queryType: 'prefixLast', + highlightPreTag: '', + highlightPostTag: '', + alternativesAsExact: ['ignorePlurals', 'singleWordSynonym'], + }; + + expect(expectedBody).toEqual(union(expectedBody, resp)); }); }); @@ -2217,15 +2260,21 @@ describe('setDictionarySettings', () => { describe('setSettings', () => { test('setSettings with minimal parameters', async () => { const req = (await client.setSettings({ - indexName: 'theIndexName', + indexName: 'cts_e2e_settings', indexSettings: { paginationLimitedTo: 10 }, forwardToReplicas: true, })) as unknown as EchoResponse; - expect(req.path).toEqual('/1/indexes/theIndexName/settings'); + expect(req.path).toEqual('/1/indexes/cts_e2e_settings/settings'); expect(req.method).toEqual('PUT'); expect(req.data).toEqual({ paginationLimitedTo: 10 }); expect(req.searchParams).toStrictEqual({ forwardToReplicas: 'true' }); + + await e2eClient.setSettings({ + indexName: 'cts_e2e_settings', + indexSettings: { paginationLimitedTo: 10 }, + forwardToReplicas: true, + }); }); test('setSettings allow boolean `typoTolerance`', async () => { diff --git a/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/SearchTest.kt b/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/SearchTest.kt index b7c2f1efc4..524576a0b9 100644 --- a/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/SearchTest.kt +++ b/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/SearchTest.kt @@ -453,11 +453,11 @@ class SearchTest { client.runTest( call = { browse( - indexName = "indexName", + indexName = "cts_e2e_browse", ) }, intercept = { - assertEquals("/1/indexes/indexName/browse".toPathSegments(), it.url.pathSegments) + assertEquals("/1/indexes/cts_e2e_browse/browse".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("POST"), it.method) assertJsonBody("""{}""", it.body) }, @@ -1284,11 +1284,11 @@ class SearchTest { client.runTest( call = { getSettings( - indexName = "theIndexName", + indexName = "cts_e2e_settings", ) }, intercept = { - assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals("/1/indexes/cts_e2e_settings/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("GET"), it.method) assertNoBody(it.body) }, @@ -2554,7 +2554,7 @@ class SearchTest { client.runTest( call = { setSettings( - indexName = "theIndexName", + indexName = "cts_e2e_settings", indexSettings = IndexSettings( paginationLimitedTo = 10, ), @@ -2562,7 +2562,7 @@ class SearchTest { ) }, intercept = { - assertEquals("/1/indexes/theIndexName/settings".toPathSegments(), it.url.pathSegments) + assertEquals("/1/indexes/cts_e2e_settings/settings".toPathSegments(), it.url.pathSegments) assertEquals(HttpMethod.parse("PUT"), it.method) assertContainsAll("""{"forwardToReplicas":"true"}""", it.url.parameters) assertJsonBody("""{"paginationLimitedTo":10}""", it.body) diff --git a/tests/output/php/src/requests/SearchTest.php b/tests/output/php/src/requests/SearchTest.php index 56de2afb11..8efee6972f 100644 --- a/tests/output/php/src/requests/SearchTest.php +++ b/tests/output/php/src/requests/SearchTest.php @@ -488,16 +488,25 @@ public function testBrowse0() { $client = $this->getClient(); $client->browse( - 'indexName', + 'cts_e2e_browse', ); $this->assertRequests([ [ - 'path' => '/1/indexes/indexName/browse', + 'path' => '/1/indexes/cts_e2e_browse/browse', 'method' => 'POST', 'body' => json_decode('{}'), ], ]); + + $e2eClient = $this->getE2EClient(); + $resp = $e2eClient->browse( + 'cts_e2e_browse', + ); + + $expected = json_decode('{"page":0,"nbHits":33191,"nbPages":34,"hitsPerPage":1000,"query":"","params":""}', true); + + $this->assertEquals($this->union($expected, $resp), $expected); } /** @@ -1435,16 +1444,25 @@ public function testGetSettings0() { $client = $this->getClient(); $client->getSettings( - 'theIndexName', + 'cts_e2e_settings', ); $this->assertRequests([ [ - 'path' => '/1/indexes/theIndexName/settings', + 'path' => '/1/indexes/cts_e2e_settings/settings', 'method' => 'GET', 'body' => null, ], ]); + + $e2eClient = $this->getE2EClient(); + $resp = $e2eClient->getSettings( + 'cts_e2e_settings', + ); + + $expected = json_decode('{"minWordSizefor1Typo":4,"minWordSizefor2Typos":8,"hitsPerPage":20,"maxValuesPerFacet":100,"version":1,"paginationLimitedTo":10,"exactOnSingleWordQuery":"attribute","ranking":["typo","geo","words","filters","proximity","attribute","exact","custom"],"separatorsToIndex":"","removeWordsIfNoResults":"none","queryType":"prefixLast","highlightPreTag":"","highlightPostTag":"","alternativesAsExact":["ignorePlurals","singleWordSynonym"]}', true); + + $this->assertEquals($this->union($expected, $resp), $expected); } /** @@ -2971,7 +2989,7 @@ public function testSetSettings0() { $client = $this->getClient(); $client->setSettings( - 'theIndexName', + 'cts_e2e_settings', ['paginationLimitedTo' => 10, ], true, @@ -2979,12 +2997,20 @@ public function testSetSettings0() $this->assertRequests([ [ - 'path' => '/1/indexes/theIndexName/settings', + 'path' => '/1/indexes/cts_e2e_settings/settings', 'method' => 'PUT', 'body' => json_decode('{"paginationLimitedTo":10}'), 'queryParameters' => json_decode('{"forwardToReplicas":"true"}', true), ], ]); + + $e2eClient = $this->getE2EClient(); + $resp = $e2eClient->setSettings( + 'cts_e2e_settings', + ['paginationLimitedTo' => 10, + ], + true, + ); } /** diff --git a/tests/output/python/tests/requests/search_test.py b/tests/output/python/tests/requests/search_test.py index 45ab1ff841..c33b9f80be 100644 --- a/tests/output/python/tests/requests/search_test.py +++ b/tests/output/python/tests/requests/search_test.py @@ -434,15 +434,29 @@ async def test_browse_0(self): browse with minimal parameters """ _req = await self._client.browse_with_http_info( - index_name="indexName", + index_name="cts_e2e_browse", ) - assert _req.path == "/1/indexes/indexName/browse" + assert _req.path == "/1/indexes/cts_e2e_browse/browse" assert _req.verb == "POST" assert _req.query_parameters.items() >= {}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads("""{}""") + resp = await SearchClient( + self._e2e_app_id, self._e2e_api_key + ).browse_with_http_info( + index_name="cts_e2e_browse", + ) + + assert resp.status_code == 200 + _expected_body = loads( + """{"page":0,"nbHits":33191,"nbPages":34,"hitsPerPage":1000,"query":"","params":""}""" + ) + assert ( + self._helpers.union(_expected_body, loads(resp.raw_data)) == _expected_body + ) + async def test_browse_1(self): """ browse with search parameters @@ -1139,15 +1153,29 @@ async def test_get_settings_0(self): getSettings0 """ _req = await self._client.get_settings_with_http_info( - index_name="theIndexName", + index_name="cts_e2e_settings", ) - assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.path == "/1/indexes/cts_e2e_settings/settings" assert _req.verb == "GET" assert _req.query_parameters.items() >= {}.items() assert _req.headers.items() >= {}.items() assert _req.data is None + resp = await SearchClient( + self._e2e_app_id, self._e2e_api_key + ).get_settings_with_http_info( + index_name="cts_e2e_settings", + ) + + assert resp.status_code == 200 + _expected_body = loads( + """{"minWordSizefor1Typo":4,"minWordSizefor2Typos":8,"hitsPerPage":20,"maxValuesPerFacet":100,"version":1,"paginationLimitedTo":10,"exactOnSingleWordQuery":"attribute","ranking":["typo","geo","words","filters","proximity","attribute","exact","custom"],"separatorsToIndex":"","removeWordsIfNoResults":"none","queryType":"prefixLast","highlightPreTag":"","highlightPostTag":"","alternativesAsExact":["ignorePlurals","singleWordSynonym"]}""" + ) + assert ( + self._helpers.union(_expected_body, loads(resp.raw_data)) == _expected_body + ) + async def test_get_sources_0(self): """ getSources0 @@ -2490,19 +2518,31 @@ async def test_set_settings_0(self): setSettings with minimal parameters """ _req = await self._client.set_settings_with_http_info( - index_name="theIndexName", + index_name="cts_e2e_settings", index_settings={ "paginationLimitedTo": 10, }, forward_to_replicas=True, ) - assert _req.path == "/1/indexes/theIndexName/settings" + assert _req.path == "/1/indexes/cts_e2e_settings/settings" assert _req.verb == "PUT" assert _req.query_parameters.items() >= {"forwardToReplicas": "true"}.items() assert _req.headers.items() >= {}.items() assert loads(_req.data) == loads("""{"paginationLimitedTo":10}""") + resp = await SearchClient( + self._e2e_app_id, self._e2e_api_key + ).set_settings_with_http_info( + index_name="cts_e2e_settings", + index_settings={ + "paginationLimitedTo": 10, + }, + forward_to_replicas=True, + ) + + assert resp.status_code == 200 + async def test_set_settings_1(self): """ setSettings allow boolean `typoTolerance` diff --git a/tests/output/ruby/test/requests/search_test.rb b/tests/output/ruby/test/requests/search_test.rb index b432e6cd14..3ab8a6fb7a 100644 --- a/tests/output/ruby/test/requests/search_test.rb +++ b/tests/output/ruby/test/requests/search_test.rb @@ -209,13 +209,19 @@ def test_batch_dictionary_entries2 # browse with minimal parameters def test_browse0 - req = @client.browse_with_http_info("indexName") + req = @client.browse_with_http_info("cts_e2e_browse") assert_equal(:post, req.method) - assert_equal('/1/indexes/indexName/browse', req.path) + assert_equal('/1/indexes/cts_e2e_browse/browse', req.path) assert(({}.to_a - req.query_params.to_a).empty?, req.query_params.to_s) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) assert_equal(JSON.parse('{}'), JSON.parse(req.body)) + + res = @e2e_client.browse_with_http_info("cts_e2e_browse") + + assert_equal(res.status, 200) + expected_body = JSON.parse('{"page":0,"nbHits":33191,"nbPages":34,"hitsPerPage":1000,"query":"","params":""}') + assert_equal(expected_body, union(expected_body, JSON.parse(res.body))) end # browse with search parameters @@ -663,14 +669,20 @@ def test_get_rule0 # getSettings0 def test_get_settings0 - req = @client.get_settings_with_http_info("theIndexName") + req = @client.get_settings_with_http_info("cts_e2e_settings") assert_equal(:get, req.method) - assert_equal('/1/indexes/theIndexName/settings', req.path) + assert_equal('/1/indexes/cts_e2e_settings/settings', req.path) assert(({}.to_a - req.query_params.to_a).empty?, req.query_params.to_s) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) assert(req.body.nil?, 'body is not nil') + + res = @e2e_client.get_settings_with_http_info("cts_e2e_settings") + + assert_equal(res.status, 200) + expected_body = JSON.parse('{"minWordSizefor1Typo":4,"minWordSizefor2Typos":8,"hitsPerPage":20,"maxValuesPerFacet":100,"version":1,"paginationLimitedTo":10,"exactOnSingleWordQuery":"attribute","ranking":["typo","geo","words","filters","proximity","attribute","exact","custom"],"separatorsToIndex":"","removeWordsIfNoResults":"none","queryType":"prefixLast","highlightPreTag":"","highlightPostTag":"","alternativesAsExact":["ignorePlurals","singleWordSynonym"]}') + assert_equal(expected_body, union(expected_body, JSON.parse(res.body))) end # getSources0 @@ -1270,13 +1282,17 @@ def test_set_dictionary_settings1 # setSettings with minimal parameters def test_set_settings0 - req = @client.set_settings_with_http_info("theIndexName", IndexSettings.new(pagination_limited_to: 10), true) + req = @client.set_settings_with_http_info("cts_e2e_settings", IndexSettings.new(pagination_limited_to: 10), true) assert_equal(:put, req.method) - assert_equal('/1/indexes/theIndexName/settings', req.path) + assert_equal('/1/indexes/cts_e2e_settings/settings', req.path) assert(({ 'forwardToReplicas': "true" }.to_a - req.query_params.to_a).empty?, req.query_params.to_s) assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s) assert_equal(JSON.parse('{"paginationLimitedTo":10}'), JSON.parse(req.body)) + + res = @e2e_client.set_settings_with_http_info("cts_e2e_settings", IndexSettings.new(pagination_limited_to: 10), true) + + assert_equal(res.status, 200) end # setSettings allow boolean `typoTolerance` diff --git a/tests/output/scala/src/test/scala/algoliasearch/requests/SearchTest.scala b/tests/output/scala/src/test/scala/algoliasearch/requests/SearchTest.scala index e8244eb727..ea8f4e07fd 100644 --- a/tests/output/scala/src/test/scala/algoliasearch/requests/SearchTest.scala +++ b/tests/output/scala/src/test/scala/algoliasearch/requests/SearchTest.scala @@ -423,13 +423,13 @@ class SearchTest extends AnyFunSuite { test("browse with minimal parameters") { val (client, echo) = testClient() val future = client.browse( - indexName = "indexName" + indexName = "cts_e2e_browse" ) Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/indexes/indexName/browse") + assert(res.path == "/1/indexes/cts_e2e_browse/browse") assert(res.method == "POST") val expectedBody = parse("""{}""") val actualBody = parse(res.body.get) @@ -1232,13 +1232,13 @@ class SearchTest extends AnyFunSuite { test("getSettings0") { val (client, echo) = testClient() val future = client.getSettings( - indexName = "theIndexName" + indexName = "cts_e2e_settings" ) Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.path == "/1/indexes/cts_e2e_settings/settings") assert(res.method == "GET") assert(res.body.isEmpty) } @@ -2563,7 +2563,7 @@ class SearchTest extends AnyFunSuite { test("setSettings with minimal parameters") { val (client, echo) = testClient() val future = client.setSettings( - indexName = "theIndexName", + indexName = "cts_e2e_settings", indexSettings = IndexSettings( paginationLimitedTo = Some(10) ), @@ -2573,7 +2573,7 @@ class SearchTest extends AnyFunSuite { Await.ready(future, Duration.Inf) val res = echo.lastResponse.get - assert(res.path == "/1/indexes/theIndexName/settings") + assert(res.path == "/1/indexes/cts_e2e_settings/settings") assert(res.method == "PUT") val expectedBody = parse("""{"paginationLimitedTo":10}""") val actualBody = parse(res.body.get)