From 43f89d889bde6732f2e76cecacba8aead7e7f442 Mon Sep 17 00:00:00 2001 From: BlackyDrum Date: Fri, 8 Nov 2024 22:42:26 +0100 Subject: [PATCH] Add test to check updated collection and fix double question mark in api url formatting --- src/ChromaDB/Client/Client.cpp | 2 +- tests/test_client.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ChromaDB/Client/Client.cpp b/src/ChromaDB/Client/Client.cpp index cb65106..d846bf3 100644 --- a/src/ChromaDB/Client/Client.cpp +++ b/src/ChromaDB/Client/Client.cpp @@ -233,7 +233,7 @@ namespace chromadb { try { - m_ChromaApiClient.Put(std::format("/collections/{}?tenant={}?&database={}", oldCollection.GetId(), m_Tenant, m_Database), json); + m_ChromaApiClient.Put(std::format("/collections/{}?tenant={}&database={}", oldCollection.GetId(), m_Tenant, m_Database), json); } catch (ChromaException& e) { diff --git a/tests/test_client.cpp b/tests/test_client.cpp index 2086f7d..fb480ae 100644 --- a/tests/test_client.cpp +++ b/tests/test_client.cpp @@ -447,6 +447,8 @@ TEST_F(ClientTest, CanUpdateCollection) EXPECT_EQ(collection2.GetId(), collection.GetId()); EXPECT_EQ(collection2.GetEmbeddingFunction(), nullptr); + EXPECT_THROW(client->GetCollection("test_collection"), ChromaInvalidCollectionException); + std::vector collections = client->GetCollections(); EXPECT_EQ(collections.size(), 1); EXPECT_EQ(collections[0].GetName(), "test_collection_updated"); @@ -483,6 +485,8 @@ TEST_F(ClientTest, CanUpdateCollectionWithMetadata) EXPECT_EQ(collection2.GetId(), collection.GetId()); EXPECT_EQ(collection2.GetEmbeddingFunction(), nullptr); + EXPECT_THROW(client->GetCollection("test_collection"), ChromaInvalidCollectionException); + std::vector collections = client->GetCollections(); EXPECT_EQ(collections.size(), 1); EXPECT_EQ(collections[0].GetName(), "test_collection_updated");