3434 QueryResultsPage ,
3535)
3636from nitric .api .exception import UnknownException
37- from nitric . proto .nitric .document .v1 import (
37+ from nitricapi .nitric .document .v1 import (
3838 Key ,
3939 Collection ,
4040 DocumentGetResponse ,
4444 ExpressionValue ,
4545 DocumentQueryStreamResponse ,
4646)
47- from nitric . proto .nitric .event .v1 import TopicListResponse , NitricTopic
47+ from nitricapi .nitric .event .v1 import TopicListResponse , NitricTopic
4848from nitric .utils import _struct_from_dict
4949
5050
@@ -56,7 +56,7 @@ class DocumentsClientTest(IsolatedAsyncioTestCase):
5656 async def test_set_document (self ):
5757 mock_set = AsyncMock ()
5858
59- with patch ("nitric.proto .nitric.document.v1.DocumentServiceStub.set" , mock_set ):
59+ with patch ("nitricapi .nitric.document.v1.DocumentServiceStub.set" , mock_set ):
6060 await Documents ().collection ("a" ).doc ("b" ).set ({"a" : 1 })
6161
6262 mock_set .assert_called_once_with (
@@ -74,7 +74,7 @@ async def test_set_document(self):
7474 async def test_set_subcollection_document (self ):
7575 mock_set = AsyncMock ()
7676
77- with patch ("nitric.proto .nitric.document.v1.DocumentServiceStub.set" , mock_set ):
77+ with patch ("nitricapi .nitric.document.v1.DocumentServiceStub.set" , mock_set ):
7878 await Documents ().collection ("a" ).doc ("b" ).collection ("c" ).doc ("d" ).set ({"a" : 1 })
7979
8080 mock_set .assert_called_once_with (
@@ -108,7 +108,7 @@ async def test_get_document(self):
108108 ),
109109 )
110110
111- with patch ("nitric.proto .nitric.document.v1.DocumentServiceStub.get" , mock_get ):
111+ with patch ("nitricapi .nitric.document.v1.DocumentServiceStub.get" , mock_get ):
112112 response = await Documents ().collection ("a" ).doc ("b" ).get ()
113113
114114 mock_get .assert_called_once_with (
@@ -139,7 +139,7 @@ async def test_get_subcollection_document(self):
139139 ),
140140 )
141141
142- with patch ("nitric.proto .nitric.document.v1.DocumentServiceStub.get" , mock_get ):
142+ with patch ("nitricapi .nitric.document.v1.DocumentServiceStub.get" , mock_get ):
143143 response : SdkDocument = await Documents ().collection ("a" ).doc ("b" ).collection ("c" ).doc ("d" ).get ()
144144
145145 mock_get .assert_called_once_with (
@@ -163,7 +163,7 @@ async def test_get_subcollection_document(self):
163163 async def test_delete_document (self ):
164164 mock_delete = AsyncMock ()
165165
166- with patch ("nitric.proto .nitric.document.v1.DocumentServiceStub.delete" , mock_delete ):
166+ with patch ("nitricapi .nitric.document.v1.DocumentServiceStub.delete" , mock_delete ):
167167 await Documents ().collection ("a" ).doc ("b" ).delete ()
168168
169169 mock_delete .assert_called_once_with (
@@ -176,7 +176,7 @@ async def test_delete_document(self):
176176 async def test_delete_subcollection_document (self ):
177177 mock_delete = AsyncMock ()
178178
179- with patch ("nitric.proto .nitric.document.v1.DocumentServiceStub.delete" , mock_delete ):
179+ with patch ("nitricapi .nitric.document.v1.DocumentServiceStub.delete" , mock_delete ):
180180 await Documents ().collection ("a" ).doc ("b" ).collection ("c" ).doc ("d" ).delete ()
181181
182182 mock_delete .assert_called_once_with (
@@ -231,7 +231,7 @@ async def test_collection_query_fetch(self):
231231 paging_token = {"b" : "c" },
232232 )
233233
234- with patch ("nitric.proto .nitric.document.v1.DocumentServiceStub.query" , mock_query ):
234+ with patch ("nitricapi .nitric.document.v1.DocumentServiceStub.query" , mock_query ):
235235 results = (
236236 await Documents ()
237237 .collection ("a" )
@@ -272,7 +272,7 @@ async def test_subcollection_query_fetch(self):
272272 paging_token = {"b" : "c" },
273273 )
274274
275- with patch ("nitric.proto .nitric.document.v1.DocumentServiceStub.query" , mock_query ):
275+ with patch ("nitricapi .nitric.document.v1.DocumentServiceStub.query" , mock_query ):
276276 results = (
277277 await Documents ()
278278 .collection ("a" )
@@ -323,7 +323,7 @@ async def mock_stream(self, **kwargs):
323323 document = Document (content = Struct (fields = {"a" : Value (number_value = i )}))
324324 )
325325
326- with patch ("nitric.proto .nitric.document.v1.DocumentServiceStub.query_stream" , mock_stream ):
326+ with patch ("nitricapi .nitric.document.v1.DocumentServiceStub.query_stream" , mock_stream ):
327327 results = []
328328 async for result in Documents ().collection ("a" ).query ().where ("name" , "startsWith" , "test" ).stream ():
329329 results .append (result )
@@ -347,31 +347,31 @@ async def test_set_document_error(self):
347347 mock_set = AsyncMock ()
348348 mock_set .side_effect = GRPCError (Status .UNKNOWN , "test error" )
349349
350- with patch ("nitric.proto .nitric.document.v1.DocumentServiceStub.set" , mock_set ):
350+ with patch ("nitricapi .nitric.document.v1.DocumentServiceStub.set" , mock_set ):
351351 with pytest .raises (UnknownException ) as e :
352352 await Documents ().collection ("a" ).doc ("b" ).set ({"a" : 1 })
353353
354354 async def test_get_document_error (self ):
355355 mock_get = AsyncMock ()
356356 mock_get .side_effect = GRPCError (Status .UNKNOWN , "test error" )
357357
358- with patch ("nitric.proto .nitric.document.v1.DocumentServiceStub.get" , mock_get ):
358+ with patch ("nitricapi .nitric.document.v1.DocumentServiceStub.get" , mock_get ):
359359 with pytest .raises (UnknownException ) as e :
360360 await Documents ().collection ("a" ).doc ("b" ).get ()
361361
362362 async def test_delete_document_error (self ):
363363 mock_delete = AsyncMock ()
364364 mock_delete .side_effect = GRPCError (Status .UNKNOWN , "test error" )
365365
366- with patch ("nitric.proto .nitric.document.v1.DocumentServiceStub.delete" , mock_delete ):
366+ with patch ("nitricapi .nitric.document.v1.DocumentServiceStub.delete" , mock_delete ):
367367 with pytest .raises (UnknownException ) as e :
368368 await Documents ().collection ("a" ).doc ("b" ).delete ()
369369
370370 async def test_query_fetch_error (self ):
371371 mock_fetch = AsyncMock ()
372372 mock_fetch .side_effect = GRPCError (Status .UNKNOWN , "test error" )
373373
374- with patch ("nitric.proto .nitric.document.v1.DocumentServiceStub.query" , mock_fetch ):
374+ with patch ("nitricapi .nitric.document.v1.DocumentServiceStub.query" , mock_fetch ):
375375 with pytest .raises (UnknownException ) as e :
376376 await Documents ().collection ("a" ).query ().fetch ()
377377
@@ -390,7 +390,7 @@ async def mock_stream(self, **kwargs):
390390 document = Document (content = Struct (fields = {"a" : Value (number_value = i )}))
391391 )
392392
393- with patch ("nitric.proto .nitric.document.v1.DocumentServiceStub.query_stream" , mock_stream ):
393+ with patch ("nitricapi .nitric.document.v1.DocumentServiceStub.query_stream" , mock_stream ):
394394 with pytest .raises (UnknownException ) as e :
395395 async for result in Documents ().collection ("a" ).query ().stream ():
396396 assert False
0 commit comments