Skip to content

Commit fecd579

Browse files
kchertenkoparthea
andauthored
chore(samples): fix product name and remove time params. (#289)
* fix: fix product name and remove time params. * fix linter Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent b97b6c9 commit fecd579

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

generated_samples/interactive-tutorials/product/remove_fulfillment_places.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,11 @@
1818
import string
1919
import time
2020

21-
import google.auth
2221
from google.cloud.retail import ProductServiceClient, RemoveFulfillmentPlacesRequest
2322

2423
from setup_product.setup_cleanup import create_product, delete_product, get_product
2524

26-
project_id = google.auth.default()[1]
2725
product_id = "".join(random.sample(string.ascii_lowercase, 8))
28-
product_name = (
29-
"projects/"
30-
+ project_id
31-
+ "/locations/global/catalogs/default_catalog/branches/default_branch/products/"
32-
+ product_id
33-
)
34-
35-
# The request timestamp
36-
current_date = datetime.datetime.now()
3726

3827

3928
# remove fulfillment request
@@ -69,8 +58,12 @@ def remove_fulfillment_places(product_name: str, timestamp, store_id):
6958
# [END retail_remove_fulfillment_places]
7059

7160

72-
create_product(product_id)
61+
product = create_product(product_id)
62+
63+
# The request timestamp
64+
current_date = datetime.datetime.now()
65+
7366
print(f"------remove fulfilment places with current date: {current_date}-----")
74-
remove_fulfillment_places(product_name, current_date, "store0")
75-
get_product(product_name)
76-
delete_product(product_name)
67+
remove_fulfillment_places(product.name, current_date, "store0")
68+
get_product(product.name)
69+
delete_product(product.name)

generated_samples/interactive-tutorials/product/remove_fulfillment_places_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ def test_add_fulfillment():
2828
'.*get product response.*?fulfillment_info.*type_: "pickup-in-store".*?place_ids: "store1".*',
2929
output,
3030
)
31+
assert not re.search(".*get product response.*?fulfillment_info.*store0.*", output)

0 commit comments

Comments
 (0)