moto/tests/test_glacier/test_glacier_vaults.py

41 lines
1.0 KiB
Python
Raw Normal View History

2018-12-21 11:28:56 +00:00
from __future__ import unicode_literals
import boto.glacier
import boto3
2018-12-21 11:28:56 +00:00
import sure # noqa
from moto import mock_glacier_deprecated, mock_glacier
2018-12-21 11:28:56 +00:00
@mock_glacier_deprecated
def test_create_vault():
conn = boto.glacier.connect_to_region("us-west-2")
conn.create_vault("my_vault")
vaults = conn.list_vaults()
vaults.should.have.length_of(1)
vaults[0].name.should.equal("my_vault")
@mock_glacier_deprecated
def test_delete_vault():
conn = boto.glacier.connect_to_region("us-west-2")
conn.create_vault("my_vault")
vaults = conn.list_vaults()
vaults.should.have.length_of(1)
conn.delete_vault("my_vault")
vaults = conn.list_vaults()
vaults.should.have.length_of(0)
@mock_glacier
def test_vault_name_with_special_characters():
vault_name = "Vault.name-with_Special.characters"
glacier = boto3.resource("glacier", region_name="us-west-2")
vault = glacier.create_vault(accountId="-", vaultName=vault_name)
vault.name.should.equal(vault_name)