Skip to content

Commit 46f0cb5

Browse files
grantEric Koleda
authored andcommitted
Update slides_snippets.py (googleworkspace#124)
* Update slides_snippets.py * refactor: Remove unused resource and method params
1 parent d31aa64 commit 46f0cb5

3 files changed

Lines changed: 4 additions & 15 deletions

File tree

slides/resources/photo.jpg

-8.85 MB
Binary file not shown.

slides/snippets/slides_snippets.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,21 +131,13 @@ def create_textbox_with_text(self, presentation_id, page_id):
131131
# [END slides_create_textbox_with_text]
132132
return response
133133

134-
def create_image(self, presentation_id, page_id, image_file_path,
135-
image_mimetype):
136-
drive_service = self.drive_service
134+
def create_image(self, presentation_id, page_id):
137135
slides_service = self.service
138136
# [START slides_create_image]
139-
# Temporarily upload a local image file to Drive, in order to obtain a
140-
# URL for the image. Alternatively, you can provide the Slides service
141-
# a URL of an already hosted image.
142-
#
143-
# We will use an existing image under the variable: IMAGE_URL.
137+
# Create a new image, using the supplied object ID,
138+
# with content downloaded from IMAGE_URL.
144139
IMAGE_URL = ('https://www.google.com/images/branding/'
145140
'googlelogo/2x/googlelogo_color_272x92dp.png')
146-
147-
# Create a new image, using the supplied object ID,
148-
# with content downloaded from image_url.
149141
requests = []
150142
image_id = 'MyImage_01'
151143
emu4M = {

slides/snippets/test_snippets.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@
1818
from slides_snippets import SlidesSnippets
1919

2020
class SnippetsTest(BaseTest):
21-
IMAGE_FILE_PATH = '../resources/photo.jpg'
2221
IMAGE_URL = 'https://www.google.com/images/' \
2322
'branding/googlelogo/2x/googlelogo_color_272x92dp.png'
24-
IMAGE_MIMETYPE = 'image/png'
2523
TEMPLATE_PRESENTATION_ID = '1E7tKQyX8H7zI7F8_v7mNDY5VyHZ3NNcjUQhkGXoITnw'
2624
DATA_SPREADSHEET_ID = '14KaZMq2aCAGt5acV77zaA_Ps8aDt04G7T0ei4KiXLX8'
2725
CHART_ID = 1107320627
@@ -68,8 +66,7 @@ def test_create_textbox_with_text(self):
6866
def test_create_image(self):
6967
presentation_id = self.create_test_presentation()
7068
page_id = self.add_slides(presentation_id, 1, 'BLANK')[0]
71-
response = self.snippets.create_image(presentation_id,
72-
page_id, SnippetsTest.IMAGE_FILE_PATH, SnippetsTest.IMAGE_MIMETYPE)
69+
response = self.snippets.create_image(presentation_id, page_id)
7370
self.assertEqual(1, len(response.get('replies')), msg=pformat(response))
7471
image_id = response.get('replies')[0].get('createImage').get('objectId')
7572
self.assertIsNotNone(image_id, msg=pformat(response))

0 commit comments

Comments
 (0)