- Copy settings files to the
pydrive2/test/settings/local
directory:
cd pydrive2/test/settings && cp *.yaml local
- Setup a Google service account for your Google Cloud Project:
- Sign into the Google API Console
- Select or Create a new
project.
- Enable the Drive API from the APIs &
Services Dashboard (left sidebar), click on + ENABLE APIS AND
SERVICES. Find and select the "Google Drive API" in the API Library, and
click on the ENABLE button.
- Go back to IAM & Admin in the left
sidebar, and select Service Accounts. Click + CREATE SERVICE
ACCOUNT, on the next screen, enter Service account name e.g. "PyDrive
tests", and click Create. Select Continue at the next Service
account permissions page, click at + CREATE KEY, select JSON and
Create. Save generated
.json
key file at your local disk.
- Copy downloaded
json
file to /tmp/pydrive2/credentials.json
directory.
- Optional. If you would like to use your own an OAuth client ID follow the steps:
- Under Google API Console select
APIs & Services from the left sidebar, and select OAuth consent screen.
Chose a User Type and click CREATE. On the next screen, enter an
Application name e.g. "PyDrive tests", and click the Save (scroll to
bottom).
- From the left sidebar, select Credentials, and click the
Create credentials dropdown to select OAuth client ID. Chose Other
and click Create to proceed with a default client name. At Credentials
screen find a list of your OAuth 2.0 Client IDs, click download icon in
front of your OAuth client id created previously. You should be prompted to
download
client_secret_xxx_.json
file.
- Copy downloaded
.json
file into pydrive2/test
directory
and rename to client_secrets.json
.
- Replace {{ }} sections
in
pydrive2/test/settings/local/test_oauth_test_02.yaml
with the
relevant values of client_id
and client_secret
from your
client_secrets.json file.
- Setup virtual environment (recommended optional step):
virtualenv -p python .env
source .env/bin/activate
- Install
tests
deps from the root directory of the project:
pip install -e .[tests,fsspec]
- Run tests:
py.test -v -s