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 +1,13 @@
from __future__ import unicode_literals
from moto.core.exceptions import JsonRESTError
class MediaPackageClientError(JsonRESTError):
code = 400
# AWS service exceptions are caught with the underlying botocore exception, ClientError
class ClientError(MediaPackageClientError):
def __init__(self, error, message):
super(ClientError, self).__init__(error, message)

View file

@ -1,8 +1,12 @@
from __future__ import unicode_literals
from boto3 import Session
from moto.core import BaseBackend, BaseModel
from collections import OrderedDict
from boto3 import Session
from moto.core import BaseBackend, BaseModel
from .exceptions import ClientError
class Channel(BaseModel):
def __init__(self, *args, **kwargs):
@ -97,8 +101,12 @@ class MediaPackageBackend(BaseBackend):
return response_channels
def describe_channel(self, id):
channel = self._channels[id]
return channel.to_dict()
try:
channel = self._channels[id]
return channel.to_dict()
except KeyError:
error = "NotFoundException"
raise ClientError(error, "channel with id={} not found".format(id))
def delete_channel(self, id):
channel = self._channels[id]