Skip to content

Commit

Permalink
Merge pull request #989 from JSee98/zipped-order-delivery-963
Browse files Browse the repository at this point in the history
Updated order delivery config for zipped orders
  • Loading branch information
sgillies authored Jul 17, 2023
2 parents 4055dbb + 8a0e672 commit 0aaf6c5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ coverage.xml

# Editors
.vscode/

# Docs build
site
4 changes: 4 additions & 0 deletions planet/order_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ def delivery(archive_type: Optional[str] = None,
if archive_type:
archive_type = specs.validate_archive_type(archive_type)

# for missing archive file name
if archive_filename is None:
archive_filename = "{{name}}_{{order_id}}.zip"

fields = ['archive_type', 'single_archive', 'archive_filename']
values = [archive_type, single_archive, archive_filename]

Expand Down
25 changes: 25 additions & 0 deletions tests/unit/test_order_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,31 @@ def test_delivery():
assert delivery_config == expected


def test_delivery_missing_archive_details():
as3_config = {
'amazon_s3': {
'aws_access_key_id': 'aws_access_key_id',
'aws_secret_access_key': 'aws_secret_access_key',
'bucket': 'bucket',
'aws_region': 'aws_region'
}
}
delivery_config = order_request.delivery(archive_type='zip',
cloud_config=as3_config)

expected = {
'archive_type': 'zip',
'archive_filename': "{{name}}_{{order_id}}.zip",
'amazon_s3': {
'aws_access_key_id': 'aws_access_key_id',
'aws_secret_access_key': 'aws_secret_access_key',
'bucket': 'bucket',
'aws_region': 'aws_region'
}
}
assert delivery_config == expected


def test_amazon_s3():
as3_config = order_request.amazon_s3('aws_access_key_id',
'aws_secret_access_key',
Expand Down

0 comments on commit 0aaf6c5

Please sign in to comment.