Creating a database that already exists in the glue data catalog raises an exception
This commit is contained in:
parent
e67a8c6f1b
commit
c5c57efbb5
3 changed files with 29 additions and 5 deletions
|
|
@ -1,7 +1,9 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import sure # noqa
|
||||
from nose.tools import assert_raises
|
||||
import boto3
|
||||
from botocore.client import ClientError
|
||||
|
||||
from moto import mock_glue
|
||||
|
||||
|
|
@ -28,3 +30,15 @@ def test_create_database():
|
|||
database = response['Database']
|
||||
|
||||
database.should.equal({'Name': database_name})
|
||||
|
||||
|
||||
@mock_glue
|
||||
def test_create_database_already_exists():
|
||||
client = boto3.client('glue', region_name='us-east-1')
|
||||
database_name = 'anewdatabase'
|
||||
create_database(client, database_name)
|
||||
|
||||
with assert_raises(ClientError) as exc:
|
||||
create_database(client, database_name)
|
||||
|
||||
exc.exception.response['Error']['Code'].should.equal('DatabaseAlreadyExistsException')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue