diff --git a/.github/workflows/draft_release.yaml b/.github/workflows/draft_release.yaml deleted file mode 100644 index dab735b..0000000 --- a/.github/workflows/draft_release.yaml +++ /dev/null @@ -1,30 +0,0 @@ -on: - pull_request: - types: [closed] - branches: - - 'main' - -jobs: - version: - if: github.event.pull_request.merged == true - name: Version and Draft Release - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Bump version and push tag - id: tag_version - uses: mathieudutour/github-tag-action@v5.5 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - - name: Create a GitHub Draft Release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.tag_version.outputs.new_tag }} - release_name: Release ${{ steps.tag_version.outputs.new_tag }} - body: ${{ steps.tag_version.outputs.changelog }} - draft: true - prerelease: false \ No newline at end of file diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index f53958d..ca4ef6d 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -11,8 +11,6 @@ jobs: - name: Checkout uses: actions/checkout@v2.3.1 with: - token: ${{secrets.SUBMOD_PAT}} - submodules: recursive fetch-depth: 0 # needed to retrieve most recent tag - name: Set up Python 3.8 uses: actions/setup-python@v2 diff --git a/.github/workflows/rc-release.yaml b/.github/workflows/rc-release.yaml new file mode 100644 index 0000000..1f442a4 --- /dev/null +++ b/.github/workflows/rc-release.yaml @@ -0,0 +1,46 @@ +name: Release Candidate +on: + pull_request: + types: [closed] + branches: + - 'develop' + +jobs: + # Bump the SDK version + version_bump: + if: github.event.pull_request.merged == true + name: Bump Version and Create Release + runs-on: ubuntu-latest + outputs: + version_id: ${{ steps.tag_version.outputs.new_tag }} + upload_url: ${{ steps.create_release.outputs.upload_url }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Bump version and push tag + id: tag_version + uses: mathieudutour/github-tag-action@v5.5 + with: + # Don't commit tag + # this will be done as part of the release + dry_run: true + github_token: ${{ secrets.GITHUB_TOKEN }} + release_branches: main,develop + + - name: Calculate RC number + id: vars + run: echo "::set-output name=rc_num::$(git rev-list --merges --count origin/develop...origin/main)" + + - name: Create a GitHub release + id: create_release + uses: actions/create-release@v1 + env: + # Use NITRIC_BOT_TOKEN here to + # trigger release 'published' workflows + GITHUB_TOKEN: ${{ secrets.NITRIC_BOT_TOKEN }} + with: + prerelease: true + tag_name: ${{ steps.tag_version.outputs.new_tag }}-rc.${{ steps.vars.outputs.rc_num }} + release_name: Release ${{ steps.tag_version.outputs.new_tag }}-rc.${{ steps.vars.outputs.rc_num }} + body: ${{ steps.tag_version.outputs.changelog }} \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..e164c30 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,37 @@ +name: Production Release +on: + pull_request: + types: [closed] + branches: + - 'main' +jobs: + # Bump the SDK version + version_bump: + if: github.event.pull_request.merged == true + name: Bump Version and Create Release + runs-on: ubuntu-latest + outputs: + version_id: ${{ steps.tag_version.outputs.new_tag }} + upload_url: ${{ steps.create_release.outputs.upload_url }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Bump version and push tag + id: tag_version + uses: mathieudutour/github-tag-action@v5.5 + with: + # Use GITHUB_TOKEN here to prevent further workflows + # generated on 'tag' action + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Create a GitHub release + id: create_release + uses: actions/create-release@v1 + env: + # Use NITRIC_BOT_TOKEN here to + # trigger release 'published' workflows + GITHUB_TOKEN: ${{ secrets.NITRIC_BOT_TOKEN }} + with: + tag_name: ${{ steps.tag_version.outputs.new_tag }} + release_name: Release ${{ steps.tag_version.outputs.new_tag }} + body: ${{ steps.tag_version.outputs.changelog }} \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bd8314f..5044cab 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -26,8 +26,6 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install run: make install - - name: Generate gRPC Client - run: make grpc-client - name: Run Tox # Run tox using the version of Python in `PATH` run: tox -e py diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 1613921..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "contracts"] - path = contracts - url = https://github.com/nitric-dev/ambassador-contracts.git diff --git a/contracts b/contracts deleted file mode 160000 index 43e281a..0000000 --- a/contracts +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 43e281ab93df628091db864580d6a1dbd6d2d0f8 diff --git a/makefile b/makefile index ca15143..1b1e868 100644 --- a/makefile +++ b/makefile @@ -3,17 +3,8 @@ install: @pip3 install -e .[dev] @pre-commit install -OUTPUT="./nitric/proto" -CONTRACTS="./contracts/proto" - .PHONY: docs clean license -grpc-client: - @echo Generating Proto Sources - @echo $(OUTPUT) - @mkdir -p $(OUTPUT) - @python3 -m grpc_tools.protoc -I $(CONTRACTS) --python_betterproto_out=$(OUTPUT) ./contracts/proto/**/**/*.proto - docs: @echo Generating SDK Documentation @pdoc3 -f --html -o docs nitric @@ -30,7 +21,7 @@ license: @licenseheaders -t tools/apache-2.tmpl -o "Nitric Technologies Pty Ltd" -y 2021 -n "Nitric Python 3 SDK" -u "https://github.com/nitrictech/python-sdk" -d tests @licenseheaders -t tools/apache-2.tmpl -o "Nitric Technologies Pty Ltd" -y 2021 -n "Nitric Python 3 SDK" -u "https://github.com/nitrictech/python-sdk" -d tools -build: clean install grpc-client license docs +build: clean install license docs @echo Building sdist and wheel @python3 setup.py sdist bdist_wheel diff --git a/nitric/api/documents.py b/nitric/api/documents.py index b28ccc3..e11f582 100644 --- a/nitric/api/documents.py +++ b/nitric/api/documents.py @@ -26,7 +26,7 @@ from nitric.api.const import MAX_SUB_COLLECTION_DEPTH from nitric.api.exception import exception_from_grpc_error -from nitric.proto.nitric.document.v1 import ( +from nitricapi.nitric.document.v1 import ( DocumentServiceStub, Collection as CollectionMessage, Key as KeyMessage, @@ -34,6 +34,7 @@ ExpressionValue, Document as DocumentMessage, ) + from nitric.utils import new_default_channel, _dict_from_struct, _struct_from_dict NIL_DOC_ID = "" @@ -228,7 +229,7 @@ def is_sub_collection(self): return self.parent is not None def to_collection_ref(self): - """Return this collection group as a collection ref""" + """Return this collection group as a collection ref.""" return CollectionRef( self._documents, self.name, @@ -241,7 +242,7 @@ def to_collection_ref(self): @staticmethod def from_collection_ref(collectionRef: CollectionRef, documents: Documents) -> CollectionGroupRef: - """Return a collection ref as a collection group""" + """Return a collection ref as a collection group.""" if collectionRef.parent is not None: return CollectionGroupRef( documents, diff --git a/nitric/api/events.py b/nitric/api/events.py index 7ccf59f..0769145 100644 --- a/nitric/api/events.py +++ b/nitric/api/events.py @@ -24,7 +24,7 @@ from nitric.api.exception import exception_from_grpc_error from nitric.utils import new_default_channel, _struct_from_dict -from nitric.proto.nitric.event.v1 import EventServiceStub, NitricEvent, TopicServiceStub +from nitricapi.nitric.event.v1 import EventServiceStub, NitricEvent, TopicServiceStub from dataclasses import dataclass, field diff --git a/nitric/api/exception.py b/nitric/api/exception.py index 8f0a112..cc45854 100644 --- a/nitric/api/exception.py +++ b/nitric/api/exception.py @@ -26,8 +26,7 @@ class NitricServiceException(Exception): class AbortedException(NitricServiceException): - """The operation was aborted, typically due to a concurrency issue such as a sequencer check failure or - transaction abort.""" + """The operation was aborted, typically due to a concurrency issue such as a transaction abort.""" pass @@ -144,6 +143,7 @@ class UnknownException(NitricServiceException): def exception_from_grpc_error(error: GRPCError): + """Translate a gRPC error to a nitric api exception.""" return exception_from_grpc_code(error.status.value, error.message) diff --git a/nitric/api/queues.py b/nitric/api/queues.py index 8afd086..1ae70cd 100644 --- a/nitric/api/queues.py +++ b/nitric/api/queues.py @@ -24,7 +24,7 @@ from nitric.api.exception import FailedPreconditionException, exception_from_grpc_error, InvalidArgumentException from nitric.utils import new_default_channel, _struct_from_dict, _dict_from_struct -from nitric.proto.nitric.queue.v1 import QueueServiceStub, NitricTask, FailedTask as WireFailedTask +from nitricapi.nitric.queue.v1 import QueueServiceStub, NitricTask, FailedTask as WireFailedTask from dataclasses import dataclass, field diff --git a/nitric/api/secrets.py b/nitric/api/secrets.py index 7de34cb..1616e47 100644 --- a/nitric/api/secrets.py +++ b/nitric/api/secrets.py @@ -24,7 +24,7 @@ from nitric.api.exception import exception_from_grpc_error from nitric.utils import new_default_channel -from nitric.proto.nitric.secret.v1 import SecretServiceStub, Secret as SecretMessage, SecretVersion as VersionMessage +from nitricapi.nitric.secret.v1 import SecretServiceStub, Secret as SecretMessage, SecretVersion as VersionMessage class Secrets(object): diff --git a/nitric/api/storage.py b/nitric/api/storage.py index 73f26fd..559d346 100644 --- a/nitric/api/storage.py +++ b/nitric/api/storage.py @@ -22,7 +22,7 @@ from nitric.api.exception import exception_from_grpc_error from nitric.utils import new_default_channel -from nitric.proto.nitric.storage.v1 import StorageServiceStub +from nitricapi.nitric.storage.v1 import StorageServiceStub class Storage(object): diff --git a/nitric/faas/faas.py b/nitric/faas/faas.py index c6c57a1..1656cff 100644 --- a/nitric/faas/faas.py +++ b/nitric/faas/faas.py @@ -25,7 +25,7 @@ from nitric.utils import new_default_channel from nitric.faas import Trigger, Response -from nitric.proto.nitric.faas.v1 import FaasServiceStub, InitRequest, ClientMessage +from nitricapi.nitric.faas.v1 import FaasServiceStub, InitRequest, ClientMessage import asyncio Handler = Callable[ diff --git a/nitric/faas/response.py b/nitric/faas/response.py index 6d56e74..7337efd 100644 --- a/nitric/faas/response.py +++ b/nitric/faas/response.py @@ -19,8 +19,8 @@ import json from dataclasses import dataclass, field from typing import Union, Any -from nitric.proto.nitric.faas import v1 -from nitric.proto.nitric.faas.v1 import TriggerResponse +from nitricapi.nitric.faas import v1 +from nitricapi.nitric.faas.v1 import TriggerResponse @dataclass(order=True) diff --git a/nitric/faas/trigger.py b/nitric/faas/trigger.py index 73a6753..24d067a 100644 --- a/nitric/faas/trigger.py +++ b/nitric/faas/trigger.py @@ -21,7 +21,7 @@ import betterproto -from nitric.proto.nitric.faas.v1 import TriggerRequest +from nitricapi.nitric.faas.v1 import TriggerRequest from nitric.faas.response import Response, TopicResponseContext, HttpResponseContext, ResponseContext @@ -94,9 +94,14 @@ def from_trigger_request(trigger_request: TriggerRequest): """Return a TriggerContext from a TriggerRequest.""" context_type, context = betterproto.which_one_of(trigger_request, "context") if context_type == "http": + if len(trigger_request.http.headers.keys()) > 0: + new_headers = {k: v[0].value for (k, v) in trigger_request.http.headers.items()} + else: + new_headers = trigger_request.http.headers_old + return TriggerContext( context=HttpTriggerContext( - headers=trigger_request.http.headers, + headers=new_headers, method=trigger_request.http.method, query_params=trigger_request.http.query_params, path=trigger_request.http.path, diff --git a/setup.py b/setup.py index bb88a3e..069af42 100644 --- a/setup.py +++ b/setup.py @@ -42,15 +42,12 @@ def get_current_version_tag(): ], setup_requires=["wheel"], install_requires=[ + "nitric-api==0.12.0rc7", "protobuf==3.13.0", - "betterproto==2.0.0b3", "asyncio", ], extras_require={ "dev": [ - "betterproto[compiler]==2.0.0b3", - # "grpcio==1.33.2", - "grpcio-tools==1.33.2", "tox==3.20.1", "twine==3.2.0", "pytest==6.0.1", diff --git a/tests/api/test_documents.py b/tests/api/test_documents.py index 5ee7ac8..69c0158 100644 --- a/tests/api/test_documents.py +++ b/tests/api/test_documents.py @@ -34,7 +34,7 @@ QueryResultsPage, ) from nitric.api.exception import UnknownException -from nitric.proto.nitric.document.v1 import ( +from nitricapi.nitric.document.v1 import ( Key, Collection, DocumentGetResponse, @@ -44,7 +44,7 @@ ExpressionValue, DocumentQueryStreamResponse, ) -from nitric.proto.nitric.event.v1 import TopicListResponse, NitricTopic +from nitricapi.nitric.event.v1 import TopicListResponse, NitricTopic from nitric.utils import _struct_from_dict @@ -56,7 +56,7 @@ class DocumentsClientTest(IsolatedAsyncioTestCase): async def test_set_document(self): mock_set = AsyncMock() - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.set", mock_set): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.set", mock_set): await Documents().collection("a").doc("b").set({"a": 1}) mock_set.assert_called_once_with( @@ -74,7 +74,7 @@ async def test_set_document(self): async def test_set_subcollection_document(self): mock_set = AsyncMock() - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.set", mock_set): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.set", mock_set): await Documents().collection("a").doc("b").collection("c").doc("d").set({"a": 1}) mock_set.assert_called_once_with( @@ -108,7 +108,7 @@ async def test_get_document(self): ), ) - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.get", mock_get): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.get", mock_get): response = await Documents().collection("a").doc("b").get() mock_get.assert_called_once_with( @@ -139,7 +139,7 @@ async def test_get_subcollection_document(self): ), ) - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.get", mock_get): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.get", mock_get): response: SdkDocument = await Documents().collection("a").doc("b").collection("c").doc("d").get() mock_get.assert_called_once_with( @@ -163,7 +163,7 @@ async def test_get_subcollection_document(self): async def test_delete_document(self): mock_delete = AsyncMock() - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.delete", mock_delete): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.delete", mock_delete): await Documents().collection("a").doc("b").delete() mock_delete.assert_called_once_with( @@ -176,7 +176,7 @@ async def test_delete_document(self): async def test_delete_subcollection_document(self): mock_delete = AsyncMock() - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.delete", mock_delete): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.delete", mock_delete): await Documents().collection("a").doc("b").collection("c").doc("d").delete() mock_delete.assert_called_once_with( @@ -231,7 +231,7 @@ async def test_collection_query_fetch(self): paging_token={"b": "c"}, ) - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.query", mock_query): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.query", mock_query): results = ( await Documents() .collection("a") @@ -272,7 +272,7 @@ async def test_subcollection_query_fetch(self): paging_token={"b": "c"}, ) - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.query", mock_query): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.query", mock_query): results = ( await Documents() .collection("a") @@ -323,7 +323,7 @@ async def mock_stream(self, **kwargs): document=Document(content=Struct(fields={"a": Value(number_value=i)})) ) - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.query_stream", mock_stream): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.query_stream", mock_stream): results = [] async for result in Documents().collection("a").query().where("name", "startsWith", "test").stream(): results.append(result) @@ -347,7 +347,7 @@ async def test_set_document_error(self): mock_set = AsyncMock() mock_set.side_effect = GRPCError(Status.UNKNOWN, "test error") - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.set", mock_set): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.set", mock_set): with pytest.raises(UnknownException) as e: await Documents().collection("a").doc("b").set({"a": 1}) @@ -355,7 +355,7 @@ async def test_get_document_error(self): mock_get = AsyncMock() mock_get.side_effect = GRPCError(Status.UNKNOWN, "test error") - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.get", mock_get): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.get", mock_get): with pytest.raises(UnknownException) as e: await Documents().collection("a").doc("b").get() @@ -363,7 +363,7 @@ async def test_delete_document_error(self): mock_delete = AsyncMock() mock_delete.side_effect = GRPCError(Status.UNKNOWN, "test error") - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.delete", mock_delete): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.delete", mock_delete): with pytest.raises(UnknownException) as e: await Documents().collection("a").doc("b").delete() @@ -371,7 +371,7 @@ async def test_query_fetch_error(self): mock_fetch = AsyncMock() mock_fetch.side_effect = GRPCError(Status.UNKNOWN, "test error") - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.query", mock_fetch): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.query", mock_fetch): with pytest.raises(UnknownException) as e: await Documents().collection("a").query().fetch() @@ -390,7 +390,7 @@ async def mock_stream(self, **kwargs): document=Document(content=Struct(fields={"a": Value(number_value=i)})) ) - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.query_stream", mock_stream): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.query_stream", mock_stream): with pytest.raises(UnknownException) as e: async for result in Documents().collection("a").query().stream(): assert False diff --git a/tests/api/test_events.py b/tests/api/test_events.py index 6a27782..ff48034 100644 --- a/tests/api/test_events.py +++ b/tests/api/test_events.py @@ -25,7 +25,7 @@ from nitric.api import Events, Event from nitric.api.exception import UnknownException -from nitric.proto.nitric.event.v1 import TopicListResponse, NitricTopic +from nitricapi.nitric.event.v1 import TopicListResponse, NitricTopic from nitric.utils import _struct_from_dict @@ -42,7 +42,7 @@ async def test_publish(self): payload = {"content": "of event"} - with patch("nitric.proto.nitric.event.v1.EventServiceStub.publish", mock_publish): + with patch("nitricapi.nitric.event.v1.EventServiceStub.publish", mock_publish): topic = Events().topic("test-topic") event = await topic.publish(Event(payload=payload)) @@ -65,7 +65,7 @@ async def test_publish_dict(self): payload = {"content": "of event"} - with patch("nitric.proto.nitric.event.v1.EventServiceStub.publish", mock_publish): + with patch("nitricapi.nitric.event.v1.EventServiceStub.publish", mock_publish): topic = Events().topic("test-topic") await topic.publish({"id": "123", "payload": payload}) @@ -85,7 +85,7 @@ async def test_publish_invalid_type(self): payload = {"content": "of event"} - with patch("nitric.proto.nitric.event.v1.EventServiceStub.publish", mock_publish): + with patch("nitricapi.nitric.event.v1.EventServiceStub.publish", mock_publish): topic = Events().topic("test-topic") with pytest.raises(Exception): await topic.publish((1, 2, 3)) @@ -98,7 +98,7 @@ async def test_publish_none(self): payload = {"content": "of event"} - with patch("nitric.proto.nitric.event.v1.EventServiceStub.publish", mock_publish): + with patch("nitricapi.nitric.event.v1.EventServiceStub.publish", mock_publish): topic = Events().topic("test-topic") await topic.publish() @@ -121,7 +121,7 @@ async def test_get_topics(self): payload = {"content": "of event"} - with patch("nitric.proto.nitric.event.v1.TopicServiceStub.list", mock_list_topics): + with patch("nitricapi.nitric.event.v1.TopicServiceStub.list", mock_list_topics): topics = await Events().topics() # Check expected values were passed to Stub @@ -134,7 +134,7 @@ async def test_publish_error(self): mock_publish = AsyncMock() mock_publish.side_effect = GRPCError(Status.UNKNOWN, "test error") - with patch("nitric.proto.nitric.event.v1.EventServiceStub.publish", mock_publish): + with patch("nitricapi.nitric.event.v1.EventServiceStub.publish", mock_publish): with pytest.raises(UnknownException) as e: await Events().topic("test-topic").publish(Event(payload={})) @@ -142,6 +142,6 @@ async def test_get_topics_error(self): mock_get_topics = AsyncMock() mock_get_topics.side_effect = GRPCError(Status.UNKNOWN, "test error") - with patch("nitric.proto.nitric.event.v1.TopicServiceStub.list", mock_get_topics): + with patch("nitricapi.nitric.event.v1.TopicServiceStub.list", mock_get_topics): with pytest.raises(UnknownException) as e: await Events().topics() diff --git a/tests/api/test_queues.py b/tests/api/test_queues.py index 5302df2..2cd4bc6 100644 --- a/tests/api/test_queues.py +++ b/tests/api/test_queues.py @@ -26,7 +26,7 @@ from nitric.api import Queues, Task from nitric.api.exception import UnknownException from nitric.api.queues import ReceivedTask -from nitric.proto.nitric.queue.v1 import ( +from nitricapi.nitric.queue.v1 import ( QueueReceiveResponse, NitricTask, QueueCompleteResponse, @@ -48,7 +48,7 @@ async def test_send(self): payload = {"content": "of task"} - with patch("nitric.proto.nitric.queue.v1.QueueServiceStub.send", mock_send): + with patch("nitricapi.nitric.queue.v1.QueueServiceStub.send", mock_send): queue = Queues().queue("test-queue") await queue.send(Task(payload=payload)) @@ -76,7 +76,7 @@ async def test_send_with_failed(self): ] ) - with patch("nitric.proto.nitric.queue.v1.QueueServiceStub.send_batch", mock_send): + with patch("nitricapi.nitric.queue.v1.QueueServiceStub.send_batch", mock_send): queue = Queues().queue("test-queue") failed = await queue.send([Task(payload=payload) for i in range(2)]) @@ -96,7 +96,7 @@ async def test_send_dict(self): payload = {"content": "of task"} - with patch("nitric.proto.nitric.queue.v1.QueueServiceStub.send", mock_send): + with patch("nitricapi.nitric.queue.v1.QueueServiceStub.send", mock_send): queue = Queues().queue("test-queue") await queue.send({"id": "123", "payload": payload}) @@ -115,7 +115,7 @@ async def test_send_invalid_type(self): payload = {"content": "of task"} - with patch("nitric.proto.nitric.queue.v1.QueueServiceStub.send", mock_send): + with patch("nitricapi.nitric.queue.v1.QueueServiceStub.send", mock_send): queue = Queues().queue("test-queue") with pytest.raises(AttributeError): await queue.send((1, 2, 3)) @@ -127,7 +127,7 @@ async def test_send_none(self): payload = {"content": "of task"} - with patch("nitric.proto.nitric.queue.v1.QueueServiceStub.send", mock_send): + with patch("nitricapi.nitric.queue.v1.QueueServiceStub.send", mock_send): queue = Queues().queue("test-queue") await queue.send() @@ -156,7 +156,7 @@ async def test_receive(self): ] ) - with patch("nitric.proto.nitric.queue.v1.QueueServiceStub.receive", mock_receive): + with patch("nitricapi.nitric.queue.v1.QueueServiceStub.receive", mock_receive): queueing = Queues() queue = queueing.queue("test-queue") (task,) = await queue.receive() @@ -186,7 +186,7 @@ async def test_receive_custom_limit(self): ] ) - with patch("nitric.proto.nitric.queue.v1.QueueServiceStub.receive", mock_receive): + with patch("nitricapi.nitric.queue.v1.QueueServiceStub.receive", mock_receive): await Queues().queue("test-queue").receive(limit=3) # explicitly set a limit # Check expected values were passed to Stub @@ -206,7 +206,7 @@ async def test_receive_below_minimum_limit(self): ] ) - with patch("nitric.proto.nitric.queue.v1.QueueServiceStub.receive", mock_receive): + with patch("nitricapi.nitric.queue.v1.QueueServiceStub.receive", mock_receive): await Queues().queue("test-queue").receive(limit=0) # explicitly set a limit # Check expected values were passed to Stub @@ -217,7 +217,7 @@ async def test_receive_task_without_payload(self): mock_receive = AsyncMock() mock_receive.return_value = QueueReceiveResponse(tasks=[NitricTask(id="test-task", lease_id="test-lease")]) - with patch("nitric.proto.nitric.queue.v1.QueueServiceStub.receive", mock_receive): + with patch("nitricapi.nitric.queue.v1.QueueServiceStub.receive", mock_receive): (task,) = await Queues().queue("test-queue").receive(limit=0) # explicitly set a limit # Verify that an empty dict is returned for payload and no payload type. @@ -232,7 +232,7 @@ async def test_complete(self): queueing = Queues() task = ReceivedTask(lease_id="test-lease", _queueing=queueing, _queue=queueing.queue("test-queue")) - with patch("nitric.proto.nitric.queue.v1.QueueServiceStub.complete", mock_complete): + with patch("nitricapi.nitric.queue.v1.QueueServiceStub.complete", mock_complete): await task.complete() # Check expected values were passed to Stub @@ -253,7 +253,7 @@ async def test_send_error(self): mock_send = AsyncMock() mock_send.side_effect = GRPCError(Status.UNKNOWN, "test error") - with patch("nitric.proto.nitric.queue.v1.QueueServiceStub.send", mock_send): + with patch("nitricapi.nitric.queue.v1.QueueServiceStub.send", mock_send): with pytest.raises(UnknownException) as e: await Queues().queue("test-queue").send(Task(payload={"content": "of task"})) @@ -261,7 +261,7 @@ async def test_send_batch_error(self): mock_send = AsyncMock() mock_send.side_effect = GRPCError(Status.UNKNOWN, "test error") - with patch("nitric.proto.nitric.queue.v1.QueueServiceStub.send_batch", mock_send): + with patch("nitricapi.nitric.queue.v1.QueueServiceStub.send_batch", mock_send): with pytest.raises(UnknownException) as e: await Queues().queue("test-queue").send([Task(payload={"content": "of task"}) for i in range(2)]) @@ -269,7 +269,7 @@ async def test_receive_error(self): mock_receive = AsyncMock() mock_receive.side_effect = GRPCError(Status.UNKNOWN, "test error") - with patch("nitric.proto.nitric.queue.v1.QueueServiceStub.receive", mock_receive): + with patch("nitricapi.nitric.queue.v1.QueueServiceStub.receive", mock_receive): with pytest.raises(UnknownException) as e: await Queues().queue("test-queue").receive() @@ -280,6 +280,6 @@ async def test_complete_error(self): queueing = Queues() task = ReceivedTask(lease_id="test-lease", _queueing=queueing, _queue=queueing.queue("test-queue")) - with patch("nitric.proto.nitric.queue.v1.QueueServiceStub.complete", mock_complete): + with patch("nitricapi.nitric.queue.v1.QueueServiceStub.complete", mock_complete): with pytest.raises(UnknownException) as e: await task.complete() diff --git a/tests/api/test_secrets.py b/tests/api/test_secrets.py index b05dfbf..3f01800 100644 --- a/tests/api/test_secrets.py +++ b/tests/api/test_secrets.py @@ -25,7 +25,7 @@ from nitric.api import Secrets from nitric.api.exception import UnknownException from nitric.api.secrets import SecretValue -from nitric.proto.nitric.secret.v1 import SecretPutResponse, SecretVersion, Secret, SecretAccessResponse +from nitricapi.nitric.secret.v1 import SecretPutResponse, SecretVersion, Secret, SecretAccessResponse class Object(object): @@ -40,7 +40,7 @@ async def test_put(self): ) mock_put.return_value = mock_response - with patch("nitric.proto.nitric.secret.v1.SecretServiceStub.put", mock_put): + with patch("nitricapi.nitric.secret.v1.SecretServiceStub.put", mock_put): secret = Secrets().secret("test-secret") result = await secret.put(b"a test secret value") @@ -60,7 +60,7 @@ async def test_put_string(self): ) mock_put.return_value = mock_response - with patch("nitric.proto.nitric.secret.v1.SecretServiceStub.put", mock_put): + with patch("nitricapi.nitric.secret.v1.SecretServiceStub.put", mock_put): secret = Secrets().secret("test-secret") await secret.put("a test secret value") # string, not bytes @@ -82,7 +82,7 @@ async def test_access(self): ) mock_access.return_value = mock_response - with patch("nitric.proto.nitric.secret.v1.SecretServiceStub.access", mock_access): + with patch("nitricapi.nitric.secret.v1.SecretServiceStub.access", mock_access): version = Secrets().secret("test-secret").latest() result = await version.access() @@ -113,7 +113,7 @@ async def test_put_error(self): mock_put = AsyncMock() mock_put.side_effect = GRPCError(Status.UNKNOWN, "test error") - with patch("nitric.proto.nitric.secret.v1.SecretServiceStub.put", mock_put): + with patch("nitricapi.nitric.secret.v1.SecretServiceStub.put", mock_put): with pytest.raises(UnknownException) as e: secret = Secrets().secret("test-secret") await secret.put(b"a test secret value") @@ -122,6 +122,6 @@ async def test_access_error(self): mock_access = AsyncMock() mock_access.side_effect = GRPCError(Status.UNKNOWN, "test error") - with patch("nitric.proto.nitric.secret.v1.SecretServiceStub.access", mock_access): + with patch("nitricapi.nitric.secret.v1.SecretServiceStub.access", mock_access): with pytest.raises(UnknownException) as e: await Secrets().secret("test-secret").latest().access() diff --git a/tests/api/test_storage.py b/tests/api/test_storage.py index cc8a48b..1bee602 100644 --- a/tests/api/test_storage.py +++ b/tests/api/test_storage.py @@ -38,7 +38,7 @@ async def test_write(self): contents = b"some text as bytes" - with patch("nitric.proto.nitric.storage.v1.StorageServiceStub.write", mock_write): + with patch("nitricapi.nitric.storage.v1.StorageServiceStub.write", mock_write): bucket = Storage().bucket("test-bucket") file = bucket.file("test-file") await file.write(contents) @@ -57,7 +57,7 @@ async def test_read(self): mock_response.body = contents mock_read.return_value = mock_response - with patch("nitric.proto.nitric.storage.v1.StorageServiceStub.read", mock_read): + with patch("nitricapi.nitric.storage.v1.StorageServiceStub.read", mock_read): bucket = Storage().bucket("test-bucket") file = bucket.file("test-file") response = await file.read() @@ -73,7 +73,7 @@ async def test_delete(self): mock_read = AsyncMock() mock_read.return_value = Object() - with patch("nitric.proto.nitric.storage.v1.StorageServiceStub.delete", mock_read): + with patch("nitricapi.nitric.storage.v1.StorageServiceStub.delete", mock_read): bucket = Storage().bucket("test-bucket") file = bucket.file("test-file") await file.delete() @@ -87,7 +87,7 @@ async def test_write_error(self): mock_write = AsyncMock() mock_write.side_effect = GRPCError(Status.UNKNOWN, "test error") - with patch("nitric.proto.nitric.storage.v1.StorageServiceStub.write", mock_write): + with patch("nitricapi.nitric.storage.v1.StorageServiceStub.write", mock_write): with pytest.raises(UnknownException) as e: await Storage().bucket("test-bucket").file("test-file").write(b"some text as bytes") @@ -95,7 +95,7 @@ async def test_read_error(self): mock_read = AsyncMock() mock_read.side_effect = GRPCError(Status.UNKNOWN, "test error") - with patch("nitric.proto.nitric.storage.v1.StorageServiceStub.read", mock_read): + with patch("nitricapi.nitric.storage.v1.StorageServiceStub.read", mock_read): with pytest.raises(UnknownException) as e: await Storage().bucket("test-bucket").file("test-file").read() @@ -103,6 +103,6 @@ async def test_delete_error(self): mock_delete = AsyncMock() mock_delete.side_effect = GRPCError(Status.UNKNOWN, "test error") - with patch("nitric.proto.nitric.storage.v1.StorageServiceStub.delete", mock_delete): + with patch("nitricapi.nitric.storage.v1.StorageServiceStub.delete", mock_delete): with pytest.raises(UnknownException) as e: await Storage().bucket("test-bucket").file("test-file").delete() diff --git a/tests/examples/test_documents_example.py b/tests/examples/test_documents_example.py index 1e4b26e..516f4a5 100644 --- a/tests/examples/test_documents_example.py +++ b/tests/examples/test_documents_example.py @@ -1,5 +1,5 @@ from examples.documents.sub_col_query import documents_sub_col_query -from nitric.proto.nitric.document.v1 import Collection, DocumentGetResponse, DocumentQueryStreamResponse, Document, Key +from nitricapi.nitric.document.v1 import Collection, DocumentGetResponse, DocumentQueryStreamResponse, Document, Key from examples.documents.set import documents_set from examples.documents.get import documents_get from examples.documents.delete import documents_delete @@ -21,7 +21,7 @@ class DocumentsExamplesTest(IsolatedAsyncioTestCase): async def test_set_document(self): mock_set = AsyncMock() - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.set", mock_set): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.set", mock_set): await documents_set() mock_set.assert_called_once() @@ -39,7 +39,7 @@ async def test_get_document(self): ), ) - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.get", mock_get): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.get", mock_get): await documents_get() mock_get.assert_called_once_with( @@ -52,7 +52,7 @@ async def test_get_document(self): async def test_delete_document(self): mock_delete = AsyncMock() - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.delete", mock_delete): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.delete", mock_delete): await documents_delete() mock_delete.assert_called_once() @@ -60,7 +60,7 @@ async def test_delete_document(self): async def test_query_document(self): mock_query = AsyncMock() - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.query", mock_query): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.query", mock_query): await documents_query() mock_query.assert_called_once() @@ -68,7 +68,7 @@ async def test_query_document(self): async def test_paged_results_document(self): mock_query = AsyncMock() - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.query", mock_query): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.query", mock_query): await documents_paged_results() mock_query.assert_called() @@ -76,7 +76,7 @@ async def test_paged_results_document(self): async def test_query_filter_document(self): mock_query = AsyncMock() - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.query", mock_query): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.query", mock_query): await documents_query_filter() mock_query.assert_called_once() @@ -84,7 +84,7 @@ async def test_query_filter_document(self): async def test_query_limits_document(self): mock_query = AsyncMock() - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.query", mock_query): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.query", mock_query): await documents_query_limits() mock_query.assert_called_once() @@ -92,7 +92,7 @@ async def test_query_limits_document(self): async def test_sub_doc_query_document(self): mock_query = AsyncMock() - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.query", mock_query): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.query", mock_query): await documents_sub_doc_query() mock_query.assert_called_once() @@ -100,7 +100,7 @@ async def test_sub_doc_query_document(self): async def test_sub_col_query_document(self): mock_query = AsyncMock() - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.query", mock_query): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.query", mock_query): await documents_sub_col_query() mock_query.assert_called_once() @@ -119,7 +119,7 @@ async def mock_stream(self, **kwargs): document=Document(content=Struct(fields={"a": Value(number_value=i)})) ) - with patch("nitric.proto.nitric.document.v1.DocumentServiceStub.query_stream", mock_stream): + with patch("nitricapi.nitric.document.v1.DocumentServiceStub.query_stream", mock_stream): await documents_streamed() self.assertEqual(3, stream_calls) diff --git a/tests/examples/test_events_example.py b/tests/examples/test_events_example.py index a6d0b18..a966414 100644 --- a/tests/examples/test_events_example.py +++ b/tests/examples/test_events_example.py @@ -9,7 +9,7 @@ class EventsExamplesTest(IsolatedAsyncioTestCase): async def test_publish_topic(self): mock_publish = AsyncMock() - with patch("nitric.proto.nitric.event.v1.EventServiceStub.publish", mock_publish): + with patch("nitricapi.nitric.event.v1.EventServiceStub.publish", mock_publish): await events_publish() mock_publish.assert_called_once() @@ -17,7 +17,7 @@ async def test_publish_topic(self): async def test_event_id_publish(self): mock_publish = AsyncMock() - with patch("nitric.proto.nitric.event.v1.EventServiceStub.publish", mock_publish): + with patch("nitricapi.nitric.event.v1.EventServiceStub.publish", mock_publish): await events_event_ids() mock_publish.assert_called_once() diff --git a/tests/examples/test_queues_example.py b/tests/examples/test_queues_example.py index c337229..cccbc80 100644 --- a/tests/examples/test_queues_example.py +++ b/tests/examples/test_queues_example.py @@ -9,7 +9,7 @@ class QueuesExamplesTest(IsolatedAsyncioTestCase): async def test_receive_queue(self): mock_receive = AsyncMock() - with patch("nitric.proto.nitric.queue.v1.QueueServiceStub.receive", mock_receive): + with patch("nitricapi.nitric.queue.v1.QueueServiceStub.receive", mock_receive): await queues_receive() mock_receive.assert_called_once() @@ -17,7 +17,7 @@ async def test_receive_queue(self): async def test_send_queue(self): mock_send = AsyncMock() - with patch("nitric.proto.nitric.queue.v1.QueueServiceStub.send", mock_send): + with patch("nitricapi.nitric.queue.v1.QueueServiceStub.send", mock_send): await queues_send() mock_send.assert_called_once() diff --git a/tests/examples/test_secrets_example.py b/tests/examples/test_secrets_example.py index ceddc1f..ba40151 100644 --- a/tests/examples/test_secrets_example.py +++ b/tests/examples/test_secrets_example.py @@ -1,4 +1,4 @@ -from nitric.proto.nitric.secret.v1 import Secret, SecretVersion, SecretAccessResponse, SecretPutResponse +from nitricapi.nitric.secret.v1 import Secret, SecretVersion, SecretAccessResponse, SecretPutResponse from examples.secrets.access import secret_access from examples.secrets.put import secret_put from examples.secrets.latest import secret_latest @@ -16,7 +16,7 @@ async def test_latest_secret(self): ) mock_latest.return_value = mock_response - with patch("nitric.proto.nitric.secret.v1.SecretServiceStub.access", mock_latest): + with patch("nitricapi.nitric.secret.v1.SecretServiceStub.access", mock_latest): await secret_latest() mock_latest.assert_called_once() @@ -35,8 +35,8 @@ async def test_put_secret(self): ) mock_access.return_value = mock_response - with patch("nitric.proto.nitric.secret.v1.SecretServiceStub.put", mock_put): - with patch("nitric.proto.nitric.secret.v1.SecretServiceStub.access", mock_access): + with patch("nitricapi.nitric.secret.v1.SecretServiceStub.put", mock_put): + with patch("nitricapi.nitric.secret.v1.SecretServiceStub.access", mock_access): await secret_put() mock_put.assert_called_once() @@ -49,7 +49,7 @@ async def test_access_secret(self): value=b"super secret value", ) mock_access.return_value = mock_response - with patch("nitric.proto.nitric.secret.v1.SecretServiceStub.access", mock_access): + with patch("nitricapi.nitric.secret.v1.SecretServiceStub.access", mock_access): await secret_access() mock_access.assert_called_once() diff --git a/tests/examples/test_storage_example.py b/tests/examples/test_storage_example.py index 5a89c13..0387faa 100644 --- a/tests/examples/test_storage_example.py +++ b/tests/examples/test_storage_example.py @@ -10,7 +10,7 @@ class StorageExamplesTest(IsolatedAsyncioTestCase): async def test_read_storage(self): mock_read = AsyncMock() - with patch("nitric.proto.nitric.storage.v1.StorageServiceStub.read", mock_read): + with patch("nitricapi.nitric.storage.v1.StorageServiceStub.read", mock_read): await storage_read() mock_read.assert_called_once() @@ -18,7 +18,7 @@ async def test_read_storage(self): async def test_write_storage(self): mock_write = AsyncMock() - with patch("nitric.proto.nitric.storage.v1.StorageServiceStub.write", mock_write): + with patch("nitricapi.nitric.storage.v1.StorageServiceStub.write", mock_write): await storage_write() mock_write.assert_called_once() @@ -26,7 +26,7 @@ async def test_write_storage(self): async def test_delete_storage(self): mock_delete = AsyncMock() - with patch("nitric.proto.nitric.storage.v1.StorageServiceStub.delete", mock_delete): + with patch("nitricapi.nitric.storage.v1.StorageServiceStub.delete", mock_delete): await storage_delete() mock_delete.assert_called_once() diff --git a/tests/faas/test_faas.py b/tests/faas/test_faas.py index ba94825..47ebd57 100644 --- a/tests/faas/test_faas.py +++ b/tests/faas/test_faas.py @@ -20,7 +20,7 @@ from unittest.mock import patch, AsyncMock, Mock, call from nitric.faas import faas, Response, ResponseContext, TopicResponseContext -from nitric.proto.nitric.faas.v1 import ( +from nitricapi.nitric.faas.v1 import ( ServerMessage, InitResponse, ClientMessage, @@ -81,7 +81,7 @@ async def mock_stream(self, request_iterator): yield message with patch("nitric.faas.faas.AsyncChannel", mock_async_channel_init), patch( - "nitric.proto.nitric.faas.v1.FaasServiceStub.trigger_stream", mock_stream + "nitricapi.nitric.faas.v1.FaasServiceStub.trigger_stream", mock_stream ), patch("nitric.faas.faas.new_default_channel", mock_grpc_channel): await faas._register_function_handler(mock_handler) @@ -120,7 +120,7 @@ async def mock_stream(self, request_iterator): yield message with patch("nitric.faas.faas.AsyncChannel", mock_async_channel_init), patch( - "nitric.proto.nitric.faas.v1.FaasServiceStub.trigger_stream", mock_stream + "nitricapi.nitric.faas.v1.FaasServiceStub.trigger_stream", mock_stream ), patch("nitric.faas.faas.new_default_channel", mock_grpc_channel): await faas._register_function_handler(mock_handler) @@ -153,7 +153,7 @@ async def mock_stream(self, request_iterator): yield message with patch("nitric.faas.faas.AsyncChannel", mock_async_channel_init), patch( - "nitric.proto.nitric.faas.v1.FaasServiceStub.trigger_stream", mock_stream + "nitricapi.nitric.faas.v1.FaasServiceStub.trigger_stream", mock_stream ), patch("nitric.faas.faas.new_default_channel", mock_grpc_channel): await faas._register_function_handler(mock_handler) @@ -182,7 +182,7 @@ async def mock_stream(self, request_iterator): yield message with patch("nitric.faas.faas.AsyncChannel", mock_async_channel_init), patch( - "nitric.proto.nitric.faas.v1.FaasServiceStub.trigger_stream", mock_stream + "nitricapi.nitric.faas.v1.FaasServiceStub.trigger_stream", mock_stream ), patch("nitric.faas.faas.new_default_channel", mock_grpc_channel): await faas._register_function_handler(mock_handler) @@ -221,7 +221,7 @@ async def mock_stream(self, request_iterator): yield message with patch("nitric.faas.faas.AsyncChannel", mock_async_channel_init), patch( - "nitric.proto.nitric.faas.v1.FaasServiceStub.trigger_stream", mock_stream + "nitricapi.nitric.faas.v1.FaasServiceStub.trigger_stream", mock_stream ), patch("nitric.faas.faas.new_default_channel", mock_grpc_channel): await faas._register_function_handler(mock_handler) @@ -261,7 +261,7 @@ async def mock_stream(self, request_iterator): yield message with patch("nitric.faas.faas.AsyncChannel", mock_async_channel_init), patch( - "nitric.proto.nitric.faas.v1.FaasServiceStub.trigger_stream", mock_stream + "nitricapi.nitric.faas.v1.FaasServiceStub.trigger_stream", mock_stream ), patch("nitric.faas.faas.new_default_channel", mock_grpc_channel): await faas._register_function_handler(mock_handler) @@ -301,7 +301,7 @@ async def mock_stream(self, request_iterator): yield message with patch("nitric.faas.faas.AsyncChannel", mock_async_channel_init), patch( - "nitric.proto.nitric.faas.v1.FaasServiceStub.trigger_stream", mock_stream + "nitricapi.nitric.faas.v1.FaasServiceStub.trigger_stream", mock_stream ), patch("nitric.faas.faas.new_default_channel", mock_grpc_channel): await faas._register_function_handler(mock_handler) @@ -342,7 +342,7 @@ async def mock_stream(self, request_iterator): yield message with patch("nitric.faas.faas.AsyncChannel", mock_async_channel_init), patch( - "nitric.proto.nitric.faas.v1.FaasServiceStub.trigger_stream", mock_stream + "nitricapi.nitric.faas.v1.FaasServiceStub.trigger_stream", mock_stream ), patch("nitric.faas.faas.new_default_channel", mock_grpc_channel): await faas._register_function_handler(mock_handler) @@ -391,7 +391,7 @@ async def mock_stream(self, request_iterator): yield message with patch("nitric.faas.faas.AsyncChannel", mock_async_channel_init), patch( - "nitric.proto.nitric.faas.v1.FaasServiceStub.trigger_stream", mock_stream + "nitricapi.nitric.faas.v1.FaasServiceStub.trigger_stream", mock_stream ), patch("nitric.faas.faas.new_default_channel", mock_grpc_channel): # An exception shouldn't be thrown, even though the serialization fails await faas._register_function_handler(mock_handler) diff --git a/tests/faas/test_trigger.py b/tests/faas/test_trigger.py index 4b215a9..838dfda 100644 --- a/tests/faas/test_trigger.py +++ b/tests/faas/test_trigger.py @@ -20,7 +20,7 @@ from unittest.mock import patch, AsyncMock, Mock, call from nitric.faas import ResponseContext, HttpResponseContext, TopicResponseContext, Trigger, TriggerContext -from nitric.proto.nitric.faas.v1 import TriggerRequest, TopicTriggerContext, HttpTriggerContext +from nitricapi.nitric.faas.v1 import TriggerRequest, TopicTriggerContext, HttpTriggerContext class ResponseContextTest(IsolatedAsyncioTestCase): diff --git a/tox.ini b/tox.ini index 0fd03ae..9d1574b 100644 --- a/tox.ini +++ b/tox.ini @@ -20,7 +20,7 @@ commands = flake8 nitric black nitric tests tools pydocstyle nitric - pip-licenses --allow-only="MIT License;BSD License;Zope Public License;Python Software Foundation License;Apache License 2.0;Apache Software License;MIT License, Mozilla Public License 2.0 (MPL 2.0);MIT;BSD License, Apache Software License;3-Clause BSD License;Historical Permission Notice and Disclaimer (HPND);Mozilla Public License 2.0 (MPL 2.0);Apache Software License, BSD License;BSD;Python Software Foundation License, MIT License;Public Domain;Public Domain, Python Software Foundation License, BSD License, GNU General Public License (GPL);GNU Library or Lesser General Public License (LGPL);LGPL;Apache Software License, MIT License" --ignore-packages nitric asyncio + pip-licenses --allow-only="MIT License;BSD License;Zope Public License;Python Software Foundation License;Apache License 2.0;Apache Software License;MIT License, Mozilla Public License 2.0 (MPL 2.0);MIT;BSD License, Apache Software License;3-Clause BSD License;Historical Permission Notice and Disclaimer (HPND);Mozilla Public License 2.0 (MPL 2.0);Apache Software License, BSD License;BSD;Python Software Foundation License, MIT License;Public Domain;Public Domain, Python Software Foundation License, BSD License, GNU General Public License (GPL);GNU Library or Lesser General Public License (LGPL);LGPL;Apache Software License, MIT License" --ignore-packages nitric nitric-api asyncio [flake8]