Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated order delivery config for zipped orders #989

Merged
merged 3 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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