Media package client error additional handling (#4011)

* Add delete container and list tags endpoints to MediaStore

* Black reformat

* Fixed Lint problems

* Check if dictionary was deleted effectively

* lint fix

* MediaPackageClientError

* Lint Fix

* Test unknown channel describe

* Concatenation Fix

* MediaPackage - fix error message

* MediaPackage Test Fix and TryError

* Lint

Co-authored-by: av <arcovoltaico@gmail.com>
Co-authored-by: Bert Blommers <info@bertblommers.nl>
This commit is contained in:
Jordi Alhambra 2021-06-16 21:07:46 +01:00 committed by GitHub
commit 407d5c853d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 94 additions and 21 deletions

View file

@ -95,6 +95,17 @@ def test_describe_unknown_channel_throws_error():
err["Message"].should.equal("channel with id={} not found".format(str(channel_id)))
@mock_mediapackage
def test_delete_unknown_channel_throws_error():
client = boto3.client("mediapackage", region_name=region)
channel_id = "unknown-channel"
with pytest.raises(ClientError) as err:
client.delete_channel(Id=channel_id)
err = err.value.response["Error"]
err["Code"].should.equal("NotFoundException")
err["Message"].should.equal("channel with id={} not found".format(str(channel_id)))
@mock_mediapackage
def test_delete_channel_successfully_deletes():
client = boto3.client("mediapackage", region_name=region)
@ -166,6 +177,19 @@ def test_describe_origin_endpoint_succeeds():
)
@mock_mediapackage
def test_describe_unknown_origin_endpoint_throws_error():
client = boto3.client("mediapackage", region_name=region)
channel_id = "unknown-channel"
with pytest.raises(ClientError) as err:
client.describe_origin_endpoint(Id=channel_id)
err = err.value.response["Error"]
err["Code"].should.equal("NotFoundException")
err["Message"].should.equal(
"origin endpoint with id={} not found".format(str(channel_id))
)
@mock_mediapackage
def test_delete_origin_endpoint_succeeds():
client = boto3.client("mediapackage", region_name=region)
@ -183,6 +207,19 @@ def test_delete_origin_endpoint_succeeds():
)
@mock_mediapackage
def test_delete_unknown_origin_endpoint_throws_error():
client = boto3.client("mediapackage", region_name=region)
channel_id = "unknown-channel"
with pytest.raises(ClientError) as err:
client.delete_origin_endpoint(Id=channel_id)
err = err.value.response["Error"]
err["Code"].should.equal("NotFoundException")
err["Message"].should.equal(
"origin endpoint with id={} not found".format(str(channel_id))
)
@mock_mediapackage
def test_update_origin_endpoint_succeeds():
client = boto3.client("mediapackage", region_name=region)
@ -197,6 +234,23 @@ def test_update_origin_endpoint_succeeds():
update_response["ManifestName"].should.equal("updated-manifest-name")
@mock_mediapackage
def test_update_unknown_origin_endpoint_throws_error():
client = boto3.client("mediapackage", region_name=region)
channel_id = "unknown-channel"
with pytest.raises(ClientError) as err:
client.update_origin_endpoint(
Id=channel_id,
Description="updated-channel-description",
ManifestName="updated-manifest-name",
)
err = err.value.response["Error"]
err["Code"].should.equal("NotFoundException")
err["Message"].should.equal(
"origin endpoint with id={} not found".format(str(channel_id))
)
@mock_mediapackage
def test_list_origin_endpoint_succeeds():
origin_endpoints_list = []