Skip to content

Commit 94a976e

Browse files
Test drive v3 (#316)
* UT for 3 region tags for app_data_snippet for drive-v3. * UT for 3 region tags for change_snippet for drive-v3. * Delete test_fetch_changes.py * Delete test_fetch_start_page_token.py * UT for 2 region tags for change_snippet for drive-v3. * UT for 6 region tags for file_snippet for drive-v3. * UT for 6 region tags for file_snippet for drive-v3. Co-authored-by: himanshupr <himanshupr@google.com>
1 parent 953ad6b commit 94a976e

12 files changed

Lines changed: 395 additions & 0 deletions
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""Copyright 2022 Google LLC
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
import unittest
16+
17+
import create_folder
18+
19+
20+
class TestCreateFolder(unittest.TestCase):
21+
"""Unit test class for file snippet"""
22+
23+
@classmethod
24+
def test_create_folder(cls):
25+
"""Test create_folder"""
26+
file_id = create_folder.create_folder()
27+
cls.assertIsNotNone(cls, file_id)
28+
29+
30+
if __name__ == '__main__':
31+
unittest.main()
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""Copyright 2022 Google LLC
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
import unittest
16+
17+
import create_shortcut
18+
19+
20+
class TestCreateShortcut(unittest.TestCase):
21+
"""Unit test class for file snippet"""
22+
23+
@classmethod
24+
def test_create_shortcut(cls):
25+
"""Test create_folder"""
26+
file_id = create_shortcut.create_shortcut()
27+
cls.assertIsNotNone(cls, file_id)
28+
29+
30+
if __name__ == '__main__':
31+
unittest.main()
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"""Copyright 2022 Google LLC
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
import unittest
16+
17+
import download_file
18+
19+
20+
class TestDownloadFile(unittest.TestCase):
21+
"""Unit test class for file snippet"""
22+
23+
@classmethod
24+
def test_download_file(cls):
25+
"""Test Download_file"""
26+
# valid file id
27+
real_file_id = '1KuPmvGq8yoYgbfW74OENMCB5H0n_2Jm9'
28+
file = download_file.download_file(real_file_id=real_file_id)
29+
cls.assertNotEqual(cls, 0, len(file))
30+
31+
32+
if __name__ == '__main__':
33+
unittest.main()
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"""Copyright 2022 Google LLC
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
import unittest
16+
17+
import export_pdf
18+
19+
20+
class TestExportPdf(unittest.TestCase):
21+
"""Unit test class for file snippet"""
22+
23+
@classmethod
24+
def test_export_pdf(cls):
25+
"""Test export_pdf"""
26+
# valid file ID
27+
real_file_id = '1zbp8wAyuImX91Jt9mI-CAX_1TqkBLDEDcr2WeXBbKUY'
28+
file = export_pdf.export_pdf(real_file_id=real_file_id)
29+
cls.assertNotEqual(cls, 0, len(file))
30+
31+
32+
if __name__ == '__main__':
33+
unittest.main()
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""Copyright 2022 Google LLC
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
import unittest
16+
17+
import move_file_to_folder
18+
19+
20+
class TestMoveFileToFolder(unittest.TestCase):
21+
"""Unit test class for file snippet"""
22+
23+
@classmethod
24+
def test_move_file_to_folder(cls):
25+
"""Test move_file_to_folder"""
26+
real_file_id = '1KuPmvGq8yoYgbfW74OENMCB5H0n_2Jm9'
27+
real_folder_id = '1v5eyIbXCr9TZX3eX_44HEExfe7yRj24V'
28+
29+
update = move_file_to_folder.move_file_to_folder(
30+
real_file_id=real_file_id, real_folder_id=real_folder_id)
31+
cls.assertIsNotNone(cls, 0, len(update))
32+
33+
34+
if __name__ == '__main__':
35+
unittest.main()
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""Copyright 2022 Google LLC
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
import unittest
16+
17+
import search_file
18+
19+
20+
class TestSearchFile(unittest.TestCase):
21+
"""Unit test class for file snippet"""
22+
23+
@classmethod
24+
def test_search_file(cls):
25+
"""Test search_file"""
26+
file = search_file.search_file()
27+
cls.assertNotEqual(cls, 0, len(file))
28+
29+
30+
if __name__ == '__main__':
31+
unittest.main()
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"""Copyright 2022 Google LLC
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
import unittest
16+
17+
import share_file
18+
19+
20+
class TestShareFile(unittest.TestCase):
21+
"""Unit test class for file snippet"""
22+
23+
@classmethod
24+
def test_share_file(cls):
25+
"""Test share_file"""
26+
real_file_id = '1dUiRSoAQKkM3a4nTPeNQWgiuau1KdQ_l'
27+
real_user = 'gduser1@workspacesamples.dev'
28+
real_domain = 'workspacesamples.dev'
29+
file = share_file.share_file(real_file_id=real_file_id,
30+
real_user=real_user,
31+
real_domain=real_domain)
32+
cls.assertNotEqual(cls, 0, len(file))
33+
34+
35+
if __name__ == '__main__':
36+
unittest.main()
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""Copyright 2022 Google LLC
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
import re
16+
import unittest
17+
from datetime import datetime
18+
19+
import touch_file
20+
21+
22+
class TestTouchFile(unittest.TestCase):
23+
"""Unit test class for file snippet"""
24+
25+
@classmethod
26+
def test_touch_file(cls):
27+
"""Test touch_file"""
28+
real_file_id = '1KuPmvGq8yoYgbfW74OENMCB5H0n_2Jm9'
29+
now = datetime.utcnow().isoformat() + 'Z'
30+
now = re.sub(r'\d{3}Z', 'Z', now) # Truncate microseconds
31+
modified_time = touch_file.touch_file(real_file_id=real_file_id,
32+
real_timestamp=now)
33+
cls.assertIsNotNone(cls, modified_time)
34+
35+
36+
if __name__ == '__main__':
37+
unittest.main()
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""Copyright 2022 Google LLC
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
import unittest
16+
17+
import upload_basic
18+
19+
20+
class TestUploadBasic(unittest.TestCase):
21+
"""Unit test class for file snippet"""
22+
23+
@classmethod
24+
def test_upload_basic(cls):
25+
"""Test upload_basic"""
26+
file_id = upload_basic.upload_basic()
27+
cls.assertIsNotNone(cls, file_id)
28+
29+
30+
if __name__ == '__main__':
31+
unittest.main()
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"""Copyright 2022 Google LLC
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
import unittest
16+
17+
import upload_revision
18+
19+
20+
class TestUploadRevision(unittest.TestCase):
21+
"""Unit test class for file snippet"""
22+
23+
@classmethod
24+
def test_upload_revision(cls):
25+
"""Test upload_revision"""
26+
27+
real_file_id = '1KuPmvGq8yoYgbfW74OENMCB5H0n_2Jm9'
28+
file_id = upload_revision.upload_revision(real_file_id=real_file_id)
29+
cls.assertIsNotNone(cls, file_id)
30+
31+
32+
if __name__ == '__main__':
33+
unittest.main()

0 commit comments

Comments
 (0)