Media package client error (#3983)

* 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

Co-authored-by: av <arcovoltaico@gmail.com>
Co-authored-by: Bert Blommers <info@bertblommers.nl>
This commit is contained in:
Jordi Alhambra 2021-06-07 13:47:49 +01:00 committed by GitHub
commit ae5653b31d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 4 deletions

View file

@ -1,7 +1,10 @@
from __future__ import unicode_literals
import boto3
import pytest
import sure # noqa
from botocore.exceptions import ClientError # Boto3 will always throw this exception
from moto import mock_mediapackage
region = "eu-west-1"
@ -11,7 +14,7 @@ def _create_channel_config(**kwargs):
id = kwargs.get("id", "channel-id")
description = kwargs.get("description", "Awesome channel!")
tags = kwargs.get("tags", {"Customer": "moto"})
channel_config = dict(Description=description, Id=id, Tags=tags,)
channel_config = dict(Description=description, Id=id, Tags=tags)
return channel_config
@ -81,6 +84,17 @@ def test_describe_channel_succeeds():
describe_response["Tags"]["Customer"].should.equal("moto")
@mock_mediapackage
def test_describe_unknown_channel_throws_error():
client = boto3.client("mediapackage", region_name=region)
channel_id = "unknown-channel"
with pytest.raises(ClientError) as err:
client.describe_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)