Require to test Python Google Cloud Function locally via mock

Viewed 220

I am new to Cloud Functions & Mock Testing in Python3.

I have written a basic python google cloud function to store a numeric string into a Google Cloud Bucket.

from google.cloud import storage
import uuid
import os 

file_name = uuid.uuid4().hex
file_content = os.urandom(32)

cloudStorage = storage.Client()
my_folder_name = 'random' + '/' + file_name
            
bucket = cloudStorage.bucket('TestBucket')
folder = bucket.blob(my_folder_name)
folder.upload_from_string( file_content , content_type="text/plain") 

Appreciate any ideas or way to write unit test script and excute it on local machine via mock?

0 Answers
Related