Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
# -- ClickUp --
# CLICKUP_ACCESS_TOKEN=

# -- Gmail --
# Required for read-only and destructive integration tests.
# Token must have the https://www.googleapis.com/auth/gmail.modify scope.
# GMAIL_ACCESS_TOKEN=
# Optional — pin to a specific thread/message for the reply test.
# Otherwise the test picks the most-recent inbox message dynamically.
# GMAIL_TEST_THREAD_ID=
# GMAIL_TEST_MESSAGE_ID=

# -- Freshdesk --
# FRESHDESK_API_KEY=
# FRESHDESK_DOMAIN=
Expand Down
362 changes: 97 additions & 265 deletions gmail/config.json

Large diffs are not rendered by default.

367 changes: 152 additions & 215 deletions gmail/gmail.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gmail/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
autohive-integrations-sdk~=1.0.2
autohive-integrations-sdk~=2.0.0
google-api-python-client
google-auth-httplib2
google-auth-oauthlib
Expand Down
26 changes: 26 additions & 0 deletions gmail/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from unittest.mock import AsyncMock, MagicMock

import pytest

# Note: the repo-root conftest.py puts the workspace root on sys.path and
# monkeypatches Integration.load() to resolve config.json from the caller
# frame, so `from gmail.gmail import gmail` resolves to the gmail/ package
# without any extra path manipulation here.


@pytest.fixture
def mock_context():
"""Mock ExecutionContext pre-loaded with the platform-OAuth shape Gmail expects.

Gmail uses platform OAuth (config.auth.type == "platform") so the SDK wraps
the access token in {"auth_type": "PlatformOauth2", "credentials": {...}}.
"""
ctx = MagicMock(name="ExecutionContext")
# gmail uses googleapiclient directly (not context.fetch), but unit tests
# still receive an AsyncMock for fetch so the standard fixture contract holds.
ctx.fetch = AsyncMock(name="fetch")
ctx.auth = {
"auth_type": "PlatformOauth2",
"credentials": {"access_token": "test_access_token"}, # nosec B105
}
return ctx
5 changes: 0 additions & 5 deletions gmail/tests/context.py

This file was deleted.

6 changes: 0 additions & 6 deletions gmail/tests/test_gmail.py

This file was deleted.

Loading
Loading