Skip to content

Commit 85fd50e

Browse files
committed
Update imported gmail snippets so tests pass
1 parent 4a9266f commit 85fd50e

8 files changed

Lines changed: 21 additions & 3170 deletions

File tree

.github/scripts/test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export LC_ALL=C.UTF-8
1717
export LANG=C.UTF-8
1818
export PIPENV_PYTHON="${PYENV_ROOT}/shims/python"
1919
export GOOGLE_APPLICATION_CREDENTIALS="${HOME}/secrets/default_credentials.json"
20+
export SERVICE_ACCOUNT_CREDENTIALS="${HOME}/secrets/service_account.json"
2021

2122
dirs=()
2223

.github/workflows/ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ jobs:
3434
run: |
3535
mkdir "${HOME}/secrets"
3636
echo "${DEFAULT_CREDENTIALS}" > "${HOME}/secrets/default_credentials.json"
37+
echo "${SERVICE_ACCOUNT_CREDENTIALS}" > "${HOME}/secrets/service_account.json"
3738
echo "${CLIENT_ID_FILE}" > "${HOME}/secrets/client_id.json"
3839
env:
3940
DEFAULT_CREDENTIALS: ${{secrets.SNIPPETS_DEFAULT_CREDENTIALS}}
41+
SERVICE_ACCOUNT_CREDENTIALS: ${{secrets.SNIPPETS_DELEGATED_ADMIN_SERVICE_ACCOUNT}}
4042
CLIENT_ID_FILE: ${{secrets.SNIPPETS_CLIENT_ID_FILE}}
4143
- name: Run tests
4244
run: ./.github/scripts/test.sh

gmail/snippet/base_test.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
class BaseTest(unittest.TestCase):
99

10-
RECIPIENT = 'gdtest2@appsrocks.com'
11-
TEST_USER = 'gdtest1@appsrocks.com'
12-
FORWARDING_ADDRESS = 'gdtest2@appsrocks.com'
10+
RECIPIENT = 'gduser01@workspacesamples.dev'
11+
TEST_USER = 'ci-test01@workspacesamples.dev'
12+
FORWARDING_ADDRESS = 'gduser01@workspacesamples.dev'
1313

1414
@classmethod
1515
def setUpClass(cls):
@@ -21,8 +21,9 @@ def create_credentials(cls):
2121
'https://www.googleapis.com/auth/gmail.send',
2222
'https://www.googleapis.com/auth/gmail.labels',
2323
'https://www.googleapis.com/auth/gmail.settings.basic',
24-
'https://www.googleapis.com/auth/gmail.settings.sharing']
25-
credentials = ServiceAccountCredentials.from_json_keyfile_name(os.environ['GOOGLE_APPLICATION_CREDENTIALS'],
24+
'https://www.googleapis.com/auth/gmail.settings.sharing',
25+
'https://mail.google.com/']
26+
credentials = ServiceAccountCredentials.from_json_keyfile_name(os.environ['SERVICE_ACCOUNT_CREDENTIALS'],
2627
scopes=scope)
2728
return credentials.create_delegated(BaseTest.TEST_USER)
2829

gmail/snippet/requirements.txt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
google-api-python-client==1.7.11
2-
google-auth-httplib2==0.0.3
3-
google-auth-oauthlib==0.4.0
4-
apiclient~=1.0.4
5-
oauth2client~=4.1.3
6-
numpy~=1.19.5
7-
httplib2~=0.18.1
1+
google-auth==2.3.3
2+
google-api-python-client==2.31.0
3+
oauth2client==4.1.3
4+
numpy==1.22.0

0 commit comments

Comments
 (0)