Skip to content
Merged
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
36 changes: 36 additions & 0 deletions drive/snippets/drive-v3/file_snippet/test_share_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""Copyright 2022 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import unittest

import share_file


class TestShareFile(unittest.TestCase):
"""Unit test class for file snippet"""

@classmethod
def test_share_file(cls):
"""Test share_file"""
real_file_id = '1dUiRSoAQKkM3a4nTPeNQWgiuau1KdQ_l'
real_user = 'gduser1@workspacesamples.dev'
real_domain = 'workspacesamples.dev'
file = share_file.share_file(real_file_id=real_file_id,
real_user=real_user,
real_domain=real_domain)
cls.assertNotEqual(cls, 0, len(file))


if __name__ == '__main__':
unittest.main()
37 changes: 37 additions & 0 deletions drive/snippets/drive-v3/file_snippet/test_touch_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""Copyright 2022 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import re
import unittest
from datetime import datetime

import touch_file


class TestTouchFile(unittest.TestCase):
"""Unit test class for file snippet"""

@classmethod
def test_touch_file(cls):
"""Test touch_file"""
real_file_id = '1KuPmvGq8yoYgbfW74OENMCB5H0n_2Jm9'
now = datetime.utcnow().isoformat() + 'Z'
now = re.sub(r'\d{3}Z', 'Z', now) # Truncate microseconds
modified_time = touch_file.touch_file(real_file_id=real_file_id,
real_timestamp=now)
cls.assertIsNotNone(cls, modified_time)


if __name__ == '__main__':
unittest.main()
31 changes: 31 additions & 0 deletions drive/snippets/drive-v3/file_snippet/test_upload_basic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Copyright 2022 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import unittest

import upload_basic


class TestUploadBasic(unittest.TestCase):
"""Unit test class for file snippet"""

@classmethod
def test_upload_basic(cls):
"""Test upload_basic"""
file_id = upload_basic.upload_basic()
cls.assertIsNotNone(cls, file_id)


if __name__ == '__main__':
unittest.main()
33 changes: 33 additions & 0 deletions drive/snippets/drive-v3/file_snippet/test_upload_revision.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Copyright 2022 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import unittest

import upload_revision


class TestUploadRevision(unittest.TestCase):
"""Unit test class for file snippet"""

@classmethod
def test_upload_revision(cls):
"""Test upload_revision"""

real_file_id = '1KuPmvGq8yoYgbfW74OENMCB5H0n_2Jm9'
file_id = upload_revision.upload_revision(real_file_id=real_file_id)
cls.assertIsNotNone(cls, file_id)


if __name__ == '__main__':
unittest.main()
33 changes: 33 additions & 0 deletions drive/snippets/drive-v3/file_snippet/test_upload_to_folder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Copyright 2022 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import unittest

import upload_to_folder


class TestUploadToFolder(unittest.TestCase):
"""Unit test class for file snippet"""

@classmethod
def test_upload_to_folder(cls):
"""Test upload_to_folder"""
real_folder_id = '1s0oKEZZXjImNngxHGnY0xed6Mw-tvspu'
file_id = upload_to_folder.upload_to_folder(
real_folder_id=real_folder_id)
cls.assertIsNotNone(cls, file_id)


if __name__ == '__main__':
unittest.main()
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Copyright 2022 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import unittest

import upload_with_conversion


class TestUploadWithConversion(unittest.TestCase):
"""Unit test class for file snippet"""

@classmethod
def test_upload_to_folder(cls):
"""Test upload_with_conversion"""
file_id = upload_with_conversion.upload_with_conversion()
cls.assertIsNotNone(cls, file_id)


if __name__ == '__main__':
unittest.main()