This commit is contained in:
Stephan 2018-12-21 12:28:56 +01:00
commit e51d1bfade
172 changed files with 49629 additions and 49629 deletions

View file

@ -1,21 +1,21 @@
from __future__ import unicode_literals
from tempfile import NamedTemporaryFile
import boto.glacier
import sure # noqa
from moto import mock_glacier_deprecated
@mock_glacier_deprecated
def test_create_and_delete_archive():
the_file = NamedTemporaryFile(delete=False)
the_file.write(b"some stuff")
the_file.close()
conn = boto.glacier.connect_to_region("us-west-2")
vault = conn.create_vault("my_vault")
archive_id = vault.upload_archive(the_file.name)
vault.delete_archive(archive_id)
from __future__ import unicode_literals
from tempfile import NamedTemporaryFile
import boto.glacier
import sure # noqa
from moto import mock_glacier_deprecated
@mock_glacier_deprecated
def test_create_and_delete_archive():
the_file = NamedTemporaryFile(delete=False)
the_file.write(b"some stuff")
the_file.close()
conn = boto.glacier.connect_to_region("us-west-2")
vault = conn.create_vault("my_vault")
archive_id = vault.upload_archive(the_file.name)
vault.delete_archive(archive_id)

View file

@ -1,90 +1,90 @@
from __future__ import unicode_literals
import json
import time
from boto.glacier.layer1 import Layer1
import sure # noqa
from moto import mock_glacier_deprecated
@mock_glacier_deprecated
def test_init_glacier_job():
conn = Layer1(region_name="us-west-2")
vault_name = "my_vault"
conn.create_vault(vault_name)
archive_id = conn.upload_archive(
vault_name, "some stuff", "", "", "some description")
job_response = conn.initiate_job(vault_name, {
"ArchiveId": archive_id,
"Type": "archive-retrieval",
})
job_id = job_response['JobId']
job_response['Location'].should.equal(
"//vaults/my_vault/jobs/{0}".format(job_id))
@mock_glacier_deprecated
def test_describe_job():
conn = Layer1(region_name="us-west-2")
vault_name = "my_vault"
conn.create_vault(vault_name)
archive_id = conn.upload_archive(
vault_name, "some stuff", "", "", "some description")
job_response = conn.initiate_job(vault_name, {
"ArchiveId": archive_id,
"Type": "archive-retrieval",
})
job_id = job_response['JobId']
job = conn.describe_job(vault_name, job_id)
joboutput = json.loads(job.read().decode("utf-8"))
joboutput.should.have.key('Tier').which.should.equal('Standard')
joboutput.should.have.key('StatusCode').which.should.equal('InProgress')
joboutput.should.have.key('VaultARN').which.should.equal('arn:aws:glacier:RegionInfo:us-west-2:012345678901:vaults/my_vault')
@mock_glacier_deprecated
def test_list_glacier_jobs():
conn = Layer1(region_name="us-west-2")
vault_name = "my_vault"
conn.create_vault(vault_name)
archive_id1 = conn.upload_archive(
vault_name, "some stuff", "", "", "some description")['ArchiveId']
archive_id2 = conn.upload_archive(
vault_name, "some other stuff", "", "", "some description")['ArchiveId']
conn.initiate_job(vault_name, {
"ArchiveId": archive_id1,
"Type": "archive-retrieval",
})
conn.initiate_job(vault_name, {
"ArchiveId": archive_id2,
"Type": "archive-retrieval",
})
jobs = conn.list_jobs(vault_name)
len(jobs['JobList']).should.equal(2)
@mock_glacier_deprecated
def test_get_job_output():
conn = Layer1(region_name="us-west-2")
vault_name = "my_vault"
conn.create_vault(vault_name)
archive_response = conn.upload_archive(
vault_name, "some stuff", "", "", "some description")
archive_id = archive_response['ArchiveId']
job_response = conn.initiate_job(vault_name, {
"ArchiveId": archive_id,
"Type": "archive-retrieval",
})
job_id = job_response['JobId']
time.sleep(6)
output = conn.get_job_output(vault_name, job_id)
output.read().decode("utf-8").should.equal("some stuff")
from __future__ import unicode_literals
import json
import time
from boto.glacier.layer1 import Layer1
import sure # noqa
from moto import mock_glacier_deprecated
@mock_glacier_deprecated
def test_init_glacier_job():
conn = Layer1(region_name="us-west-2")
vault_name = "my_vault"
conn.create_vault(vault_name)
archive_id = conn.upload_archive(
vault_name, "some stuff", "", "", "some description")
job_response = conn.initiate_job(vault_name, {
"ArchiveId": archive_id,
"Type": "archive-retrieval",
})
job_id = job_response['JobId']
job_response['Location'].should.equal(
"//vaults/my_vault/jobs/{0}".format(job_id))
@mock_glacier_deprecated
def test_describe_job():
conn = Layer1(region_name="us-west-2")
vault_name = "my_vault"
conn.create_vault(vault_name)
archive_id = conn.upload_archive(
vault_name, "some stuff", "", "", "some description")
job_response = conn.initiate_job(vault_name, {
"ArchiveId": archive_id,
"Type": "archive-retrieval",
})
job_id = job_response['JobId']
job = conn.describe_job(vault_name, job_id)
joboutput = json.loads(job.read().decode("utf-8"))
joboutput.should.have.key('Tier').which.should.equal('Standard')
joboutput.should.have.key('StatusCode').which.should.equal('InProgress')
joboutput.should.have.key('VaultARN').which.should.equal('arn:aws:glacier:RegionInfo:us-west-2:012345678901:vaults/my_vault')
@mock_glacier_deprecated
def test_list_glacier_jobs():
conn = Layer1(region_name="us-west-2")
vault_name = "my_vault"
conn.create_vault(vault_name)
archive_id1 = conn.upload_archive(
vault_name, "some stuff", "", "", "some description")['ArchiveId']
archive_id2 = conn.upload_archive(
vault_name, "some other stuff", "", "", "some description")['ArchiveId']
conn.initiate_job(vault_name, {
"ArchiveId": archive_id1,
"Type": "archive-retrieval",
})
conn.initiate_job(vault_name, {
"ArchiveId": archive_id2,
"Type": "archive-retrieval",
})
jobs = conn.list_jobs(vault_name)
len(jobs['JobList']).should.equal(2)
@mock_glacier_deprecated
def test_get_job_output():
conn = Layer1(region_name="us-west-2")
vault_name = "my_vault"
conn.create_vault(vault_name)
archive_response = conn.upload_archive(
vault_name, "some stuff", "", "", "some description")
archive_id = archive_response['ArchiveId']
job_response = conn.initiate_job(vault_name, {
"ArchiveId": archive_id,
"Type": "archive-retrieval",
})
job_id = job_response['JobId']
time.sleep(6)
output = conn.get_job_output(vault_name, job_id)
output.read().decode("utf-8").should.equal("some stuff")

View file

@ -1,22 +1,22 @@
from __future__ import unicode_literals
import json
import sure # noqa
import moto.server as server
from moto import mock_glacier
'''
Test the different server responses
'''
@mock_glacier
def test_list_vaults():
backend = server.create_backend_app("glacier")
test_client = backend.test_client()
res = test_client.get('/1234bcd/vaults')
json.loads(res.data.decode("utf-8")
).should.equal({u'Marker': None, u'VaultList': []})
from __future__ import unicode_literals
import json
import sure # noqa
import moto.server as server
from moto import mock_glacier
'''
Test the different server responses
'''
@mock_glacier
def test_list_vaults():
backend = server.create_backend_app("glacier")
test_client = backend.test_client()
res = test_client.get('/1234bcd/vaults')
json.loads(res.data.decode("utf-8")
).should.equal({u'Marker': None, u'VaultList': []})

View file

@ -1,31 +1,31 @@
from __future__ import unicode_literals
import boto.glacier
import sure # noqa
from moto import mock_glacier_deprecated
@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)
from __future__ import unicode_literals
import boto.glacier
import sure # noqa
from moto import mock_glacier_deprecated
@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)