diff --git a/drive/snippets/drive-v3/app_data_snippet/test_fetch_appdata_folder.py b/drive/snippets/drive-v3/app_data_snippet/test_fetch_appdata_folder.py new file mode 100644 index 00000000..c48b3472 --- /dev/null +++ b/drive/snippets/drive-v3/app_data_snippet/test_fetch_appdata_folder.py @@ -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 fetch_appdata_folder + + +class TestFetchAppdataFolder(unittest.TestCase): + """Unit test class for Appdata snippet""" + + @classmethod + def test_list_appdata(cls): + """Test list_appdata""" + file_id = fetch_appdata_folder.fetch_appdata_folder() + cls.assertIsNotNone(cls, file_id) + + +if __name__ == '__main__': + unittest.main() diff --git a/drive/snippets/drive-v3/app_data_snippet/test_list_appdata.py b/drive/snippets/drive-v3/app_data_snippet/test_list_appdata.py new file mode 100644 index 00000000..dd66a706 --- /dev/null +++ b/drive/snippets/drive-v3/app_data_snippet/test_list_appdata.py @@ -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 list_appdata + + +class TestListAppdata(unittest.TestCase): + """Unit test class for Appdata snippet""" + + @classmethod + def test_list_appdata(cls): + """Test list_appdata""" + files = list_appdata.list_appdata() + cls.assertNotEqual(cls, 0, len(files)) + + +if __name__ == '__main__': + unittest.main() diff --git a/drive/snippets/drive-v3/app_data_snippet/test_upload_appdata.py b/drive/snippets/drive-v3/app_data_snippet/test_upload_appdata.py new file mode 100644 index 00000000..95b5025b --- /dev/null +++ b/drive/snippets/drive-v3/app_data_snippet/test_upload_appdata.py @@ -0,0 +1,35 @@ +"""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_app_data + + +class TestUploadAppdata(unittest.TestCase): + """ + Unit test class for Appdata snippet + """ + + @classmethod + def test_upload_adddata(cls): + """Test upload_appdata + create a text file titled "abc.txt" in order to pass this test + """ + file_id = upload_app_data.upload_appdata() + cls.assertIsNotNone(cls, file_id) + + +if __name__ == '__main__': + unittest.main() diff --git a/drive/snippets/drive-v3/change_snippet/test_fetch_changes.py b/drive/snippets/drive-v3/change_snippet/test_fetch_changes.py new file mode 100644 index 00000000..a172f69e --- /dev/null +++ b/drive/snippets/drive-v3/change_snippet/test_fetch_changes.py @@ -0,0 +1,34 @@ +"""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 fetch_changes +import fetch_start_page_token + + +class TestFetchChanges(unittest.TestCase): + """Unit test classs for Change snippet""" + + @classmethod + def test_fetch_changes(cls): + """Test fetch_changes""" + start_token = fetch_start_page_token.fetch_start_page_token() + token = fetch_changes.fetch_changes(start_token) + cls.assertIsNotNone(cls, token) + + +if __name__ == '__main__': + unittest.main() diff --git a/drive/snippets/drive-v3/change_snippet/test_fetch_start_page_token.py b/drive/snippets/drive-v3/change_snippet/test_fetch_start_page_token.py new file mode 100644 index 00000000..9405cfa6 --- /dev/null +++ b/drive/snippets/drive-v3/change_snippet/test_fetch_start_page_token.py @@ -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 fetch_start_page_token + + +class TestFetchChanges(unittest.TestCase): + """Unit test classs for Change snippet""" + + @classmethod + def test_fetch_start_page_token(cls): + """Test fetch_start_page_token""" + token = fetch_start_page_token.fetch_start_page_token() + cls.assertIsNotNone(cls, token) + + +if __name__ == '__main__': + unittest.main() diff --git a/drive/snippets/drive-v3/file_snippet/test_create_folder.py b/drive/snippets/drive-v3/file_snippet/test_create_folder.py new file mode 100644 index 00000000..1cb7bfbd --- /dev/null +++ b/drive/snippets/drive-v3/file_snippet/test_create_folder.py @@ -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 create_folder + + +class TestCreateFolder(unittest.TestCase): + """Unit test class for file snippet""" + + @classmethod + def test_create_folder(cls): + """Test create_folder""" + file_id = create_folder.create_folder() + cls.assertIsNotNone(cls, file_id) + + +if __name__ == '__main__': + unittest.main() diff --git a/drive/snippets/drive-v3/file_snippet/test_create_shortcut.py b/drive/snippets/drive-v3/file_snippet/test_create_shortcut.py new file mode 100644 index 00000000..2e2f3080 --- /dev/null +++ b/drive/snippets/drive-v3/file_snippet/test_create_shortcut.py @@ -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 create_shortcut + + +class TestCreateShortcut(unittest.TestCase): + """Unit test class for file snippet""" + + @classmethod + def test_create_shortcut(cls): + """Test create_folder""" + file_id = create_shortcut.create_shortcut() + cls.assertIsNotNone(cls, file_id) + + +if __name__ == '__main__': + unittest.main() diff --git a/drive/snippets/drive-v3/file_snippet/test_download_file.py b/drive/snippets/drive-v3/file_snippet/test_download_file.py new file mode 100644 index 00000000..724b780c --- /dev/null +++ b/drive/snippets/drive-v3/file_snippet/test_download_file.py @@ -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 download_file + + +class TestDownloadFile(unittest.TestCase): + """Unit test class for file snippet""" + + @classmethod + def test_download_file(cls): + """Test Download_file""" + # valid file id + real_file_id = '1KuPmvGq8yoYgbfW74OENMCB5H0n_2Jm9' + file = download_file.download_file(real_file_id=real_file_id) + cls.assertNotEqual(cls, 0, len(file)) + + +if __name__ == '__main__': + unittest.main() diff --git a/drive/snippets/drive-v3/file_snippet/test_export_pdf.py b/drive/snippets/drive-v3/file_snippet/test_export_pdf.py new file mode 100644 index 00000000..cf0ecb9f --- /dev/null +++ b/drive/snippets/drive-v3/file_snippet/test_export_pdf.py @@ -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 export_pdf + + +class TestExportPdf(unittest.TestCase): + """Unit test class for file snippet""" + + @classmethod + def test_export_pdf(cls): + """Test export_pdf""" + # valid file ID + real_file_id = '1zbp8wAyuImX91Jt9mI-CAX_1TqkBLDEDcr2WeXBbKUY' + file = export_pdf.export_pdf(real_file_id=real_file_id) + cls.assertNotEqual(cls, 0, len(file)) + + +if __name__ == '__main__': + unittest.main() diff --git a/drive/snippets/drive-v3/file_snippet/test_move_file_to_folder.py b/drive/snippets/drive-v3/file_snippet/test_move_file_to_folder.py new file mode 100644 index 00000000..579bf37f --- /dev/null +++ b/drive/snippets/drive-v3/file_snippet/test_move_file_to_folder.py @@ -0,0 +1,35 @@ +"""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 move_file_to_folder + + +class TestMoveFileToFolder(unittest.TestCase): + """Unit test class for file snippet""" + + @classmethod + def test_move_file_to_folder(cls): + """Test move_file_to_folder""" + real_file_id = '1KuPmvGq8yoYgbfW74OENMCB5H0n_2Jm9' + real_folder_id = '1v5eyIbXCr9TZX3eX_44HEExfe7yRj24V' + + update = move_file_to_folder.move_file_to_folder( + real_file_id=real_file_id, real_folder_id=real_folder_id) + cls.assertIsNotNone(cls, 0, len(update)) + + +if __name__ == '__main__': + unittest.main() diff --git a/drive/snippets/drive-v3/file_snippet/test_search_file.py b/drive/snippets/drive-v3/file_snippet/test_search_file.py new file mode 100644 index 00000000..964d2a6b --- /dev/null +++ b/drive/snippets/drive-v3/file_snippet/test_search_file.py @@ -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 search_file + + +class TestSearchFile(unittest.TestCase): + """Unit test class for file snippet""" + + @classmethod + def test_search_file(cls): + """Test search_file""" + file = search_file.search_file() + cls.assertNotEqual(cls, 0, len(file)) + + +if __name__ == '__main__': + unittest.main() diff --git a/drive/snippets/drive-v3/file_snippet/test_share_file.py b/drive/snippets/drive-v3/file_snippet/test_share_file.py new file mode 100644 index 00000000..85392192 --- /dev/null +++ b/drive/snippets/drive-v3/file_snippet/test_share_file.py @@ -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() diff --git a/drive/snippets/drive-v3/file_snippet/test_touch_file.py b/drive/snippets/drive-v3/file_snippet/test_touch_file.py new file mode 100644 index 00000000..cd1f68a4 --- /dev/null +++ b/drive/snippets/drive-v3/file_snippet/test_touch_file.py @@ -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() diff --git a/drive/snippets/drive-v3/file_snippet/test_upload_basic.py b/drive/snippets/drive-v3/file_snippet/test_upload_basic.py new file mode 100644 index 00000000..3d6c473d --- /dev/null +++ b/drive/snippets/drive-v3/file_snippet/test_upload_basic.py @@ -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() diff --git a/drive/snippets/drive-v3/file_snippet/test_upload_revision.py b/drive/snippets/drive-v3/file_snippet/test_upload_revision.py new file mode 100644 index 00000000..88f396e5 --- /dev/null +++ b/drive/snippets/drive-v3/file_snippet/test_upload_revision.py @@ -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() diff --git a/drive/snippets/drive-v3/file_snippet/test_upload_to_folder.py b/drive/snippets/drive-v3/file_snippet/test_upload_to_folder.py new file mode 100644 index 00000000..4b129df3 --- /dev/null +++ b/drive/snippets/drive-v3/file_snippet/test_upload_to_folder.py @@ -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() diff --git a/drive/snippets/drive-v3/file_snippet/test_upload_with_conversion.py b/drive/snippets/drive-v3/file_snippet/test_upload_with_conversion.py new file mode 100644 index 00000000..563f5c70 --- /dev/null +++ b/drive/snippets/drive-v3/file_snippet/test_upload_with_conversion.py @@ -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()