Skip to content

Commit

Permalink
Add title to process_client.patch_layer
Browse files Browse the repository at this point in the history
  • Loading branch information
jirik committed Nov 30, 2020
1 parent 0bc289e commit 2cae1bc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/process_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def publish_layer(username, layername, file_paths, headers=None):
return layername


def patch_layer(username, layername, file_paths, headers=None):
def patch_layer(username, layername, file_paths=None, headers=None, title=None):
file_paths = file_paths or []
headers = headers or {}
rest_url = f"http://{settings.LAYMAN_SERVER_NAME}/rest"

Expand All @@ -55,10 +56,13 @@ def patch_layer(username, layername, file_paths, headers=None):
assert os.path.isfile(fp)
files = []
try:
data = dict()
if title:
data['title'] = title
r = requests.patch(r_url, files=[
('file', (os.path.basename(fp), open(fp, 'rb')))
for fp in file_paths
], headers=headers)
], headers=headers, data=data)
assert r.status_code == 200, r.text
finally:
for fp in files:
Expand Down

0 comments on commit 2cae1bc

Please sign in to comment.