-
Notifications
You must be signed in to change notification settings - Fork 72
Service Account auth from saved credentials; Fix and run tests on Travis. #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bcb5e2b
ServiceAuth from saved credentials; Fix Travis tests
maxhora 5a9a5cd
Rename settings yaml files; Use default.yaml to run automated tests.
maxhora f19c851
Remove lamdba from pydrive_retry calls
maxhora 0696e66
Make tests with marker "manual" instead of "automated"
maxhora b63ab7f
Update deps requirements; Do not pass exceptions on test files creati…
maxhora 43b5c34
Check if file exists before deleting
maxhora 930e5ff
Update setup.py
shcheklein File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,12 @@ | ||
| client_config_backend: 'file' | ||
| client_config_file: 'configs/client_secrets.json' | ||
| client_config_backend: file | ||
| service_config: | ||
| client_service_email: your-service-account-email | ||
| client_pkcs12_file_path: your-file-path.p12 | ||
| client_user_email: | ||
|
|
||
| save_credentials: True | ||
| save_credentials_backend: 'file' | ||
| save_credentials_file: 'credentials/1.dat' | ||
| save_credentials_backend: file | ||
| save_credentials_file: credentials/default.dat | ||
|
|
||
| oauth_scope: | ||
| - 'https://www.googleapis.com/auth/drive' | ||
| - https://www.googleapis.com/auth/drive |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| client_config_backend: 'file' | ||
| client_config_file: 'configs/client_secrets.json' | ||
|
|
||
| save_credentials: True | ||
| save_credentials_backend: 'file' | ||
| save_credentials_file: 'credentials/1.dat' | ||
|
|
||
| oauth_scope: | ||
| - 'https://www.googleapis.com/auth/drive' |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,38 @@ | ||
| import unittest | ||
| import pytest | ||
|
|
||
| from pydrive2.auth import GoogleAuth | ||
| from pydrive2.drive import GoogleDrive | ||
| from pydrive2.test.test_util import pydrive_retry, setup_credentials | ||
|
|
||
|
|
||
| class ApiAttributeTest(unittest.TestCase): | ||
shcheklein marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """Test ApiAttr functions. | ||
| """ | ||
| ga = GoogleAuth('settings/test1.yaml') | ||
| ga.LocalWebserverAuth() | ||
| first_file = 'a.png' | ||
| second_file = 'b.png' | ||
|
|
||
| @classmethod | ||
| def setup_class(cls): | ||
| setup_credentials() | ||
|
|
||
| def test_UpdateMetadataNotInfinitelyNesting(self): | ||
| # Verify 'metadata' field present. | ||
| self.assertTrue(self.file1.metadata is not None) | ||
| self.file1.UpdateMetadata() | ||
| self.file1.UpdateMetadata() | ||
| pydrive_retry(self.file1.UpdateMetadata) | ||
|
|
||
| # Verify 'metadata' field still present. | ||
| self.assertTrue(self.file1.metadata is not None) | ||
| # Ensure no 'metadata' field in 'metadata' (i.e. nested). | ||
| self.assertTrue('metadata' not in self.file1.metadata) | ||
|
|
||
| def setUp(self): | ||
| self.drive = GoogleDrive(self.ga) | ||
| ga = GoogleAuth('pydrive2/test/settings/default.yaml') | ||
| ga.ServiceAuth() | ||
| self.drive = GoogleDrive(ga) | ||
| self.file1 = self.drive.CreateFile() | ||
| self.file1.Upload() | ||
| pydrive_retry(self.file1.Upload) | ||
|
|
||
| def tearDown(self): | ||
| self.file1.Delete() | ||
| pydrive_retry(self.file1.Delete) | ||
|
|
||
| if __name__ == '__main__': | ||
| unittest.main() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.